The QGraphicsScene is destroyed when falling out of scope if you create it on the stack.
Not sure about KMainWindow, but in a normal QMainWindow subclass you could do something like:
MainWindow
::MainWindow(QWidget *parent
){
scene->addText("Hello, world!");
view->setScene(scene);
setCentralWidget(view);
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QGraphicsView *view = new QGraphicsView;
QGraphicsScene *scene = new QGraphicsScene(0, 0, 1366, 768, this);
scene->addText("Hello, world!");
view->setScene(scene);
setCentralWidget(view);
}
To copy to clipboard, switch view to plain text mode
Bookmarks