qgraphicsview as mainwindow
Window::Window(QWidget *parent): KMainWindow(parent)
{
view=new QGraphicsView(this);
QGraphicsScene scene(0,0,1366,768);
scene.addText("Hello, world!");
view->setScene(&scene);
view->show();
}
i created above as my mainwindow .
"hello world " is not displaying on the window
Re: qgraphicsview as mainwindow
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:
Code:
MainWindow
::MainWindow(QWidget *parent
){
scene->addText("Hello, world!");
view->setScene(scene);
setCentralWidget(view);
}
Re: qgraphicsview as mainwindow
QGraphicsView *view=new QGraphicsView(this);
QGraphicsScene *scene=new QGraphicsScene(0, 0, 1366, 768);
worked:)