QGraphicsScene scene; //scene.setSceneRect(-300, -300, 600, 600); scene.addText("Text"); QGraphicsView view(&scene); view.setBackgroundBrush(QPixmap(":/Resources/cheese.jpg")); view.show();
QGItem::QGItem(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags){ ui.setupUi(this); setCentralWidget(&view);}
QGItem::QGItem(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); QGraphicsScene *scene = new QGraphicsScene(); scene->setSceneRect(-300, -300, 600, 600); scene->addText("Text"); QGraphicsView *view = new QGraphicsView(scene); view->setBackgroundBrush(QPixmap(":/Resources/cheese.jpg")); setCentralWidget(view); }