graphicsView->setScene causes SIGSEGV
Solved
General and Desktop
-
#include <QApplication> #include <QCoreApplication> #include <QDebug> #include <QtGui> #include <QMainWindow> #include <QSerialPort> #include <QThread> #include <cstring> #include <fstream> #include <functional> #include <iostream> #include <sstream> #include <string> #include "Ui_MainWindow.h" Ui_MainWindow *m_ui; QGraphicsScene * m_GScene; m_GScene = new QGraphicsScene(); m_ui->graphicsView->setScene(m_GScene);
?graphicsView->setScene causes SIGSEGV?
not sure where i got
graphicsView->setScene
what is causing SIGSEGV? how to fix?
-
order
it was the order
m_ui got assigned after m_ui got called. -
#include <QApplication> #include <QGraphicsView> #include <QGraphicsScene> #include <QPointF> #include <QVector> int main(int argc, char *argv[]) { QApplication a(argc, argv); QVector <QPointF> points; // Fill in points with n number of points for(int i = 0; i< 100; i++) points.append(QPointF(i*5, i*5)); // Create a view, put a scene in it and add tiny circles // in the scene QGraphicsView * view = new QGraphicsView(); QGraphicsScene * scene = new QGraphicsScene(); view->setScene(scene); for(int i = 0; i< points.size(); i++) scene->addEllipse(points[i].x(), points[i].y(), 1, 1); // Show the view view->show(); // or add the view to the layout inside another widget return a.exec(); }
this is from stackoverflow, and runs
what is based my code bit on -
@JoeCFD said in graphicsView->setScene causes SIGSEGV:
show more of your code if you want to be helped.
ok. i included the include files
-
order
it was the order
m_ui got assigned after m_ui got called.