Segmentation fault in QGraphicsView::setScene()
I have a normal widget application which should show a finite automata in a graphic view widget. I add a QGgraphicsView to the main window, which has an instance of QGraphicsScene:
MainWindow::MainWindow(QWidget *parent) :
ui->graphicsView->setScene(scene); // bumb!
Program crashes by a segmentation fault when it tries to set scene for graphicsView.
scene is just constructed in initialization list using new operator. So I trust the new operator won't screw it up.
@ui->graphicsView->setScene(scene); // bumb!@
Looking at the above line - could be because of either 'ui' or 'graphicsView' - may be not a valid pointer?
Since you didn't include the class definition, mine is just a guess but try deleting ui-> or replacing it with this->
@graphicsView->setScene(scene);@ and see if it work (it should ;) )
Or may be try clean and build or rebuild.