PDA

View Full Version : QGraphicsScene in a Qt Console Application



ClintEastwood
23rd March 2014, 19:54
Hi all,

I'm using a qgraphicsscene inside of a qt console application, but it crashes when closing the console window due to some memory problem.

I have reduced my code to the minimum expression to reproduce the error:



#include <QGraphicsScene>
#include <QtCore/QCoreApplication>

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

QGraphicsScene scene;

return a.exec();
}


I can compile this code, but i get this error when I close the window:

10163

If someone is wondering why I'm using a qgraphicsscene in a qt console application, it is due I'm using the scene to detect collisions from real vehicles (I receive their positions from different sockets, and I do not need to display them, I just want to detect if they are going to collide).

Can anyone help me?

stampede
23rd March 2014, 20:10
QGraphicsScene is a part of QtGui module (or QtWidgets in Qt5). Change QCoreApplication to QApplication and it should work.