QGraphicsView inside QMainWindow does not work ? (all code snippet pasted)
Solved
General and Desktop
-
I've no idea why the main window does not display the intended text, yet only blank ?
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QGraphicsScene scene; scene.addText("Hello, world!"); QGraphicsView *view = new QGraphicsView(this); view->setScene(&scene); this->setCentralWidget(view); }
-
@qt_fan_4k
Hello,
Yourscene
object is on the stack, so it will be destroyed when the constructor exits.Kind regards.