Results 1 to 2 of 2

Thread: QGraphicsScene in a Qt Console Application

  1. #1

    Default QGraphicsScene in a Qt Console Application

    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:

    Qt Code:
    1. #include <QGraphicsScene>
    2. #include <QtCore/QCoreApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QCoreApplication a(argc, argv);
    7.  
    8.  
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

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

    error.JPG

    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?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QGraphicsScene in a Qt Console Application

    QGraphicsScene is a part of QtGui module (or QtWidgets in Qt5). Change QCoreApplication to QApplication and it should work.

Similar Threads

  1. Replies: 8
    Last Post: 23rd August 2012, 19:28
  2. Replies: 2
    Last Post: 15th February 2012, 14:20
  3. about console application
    By jirach_gag in forum Qt Programming
    Replies: 2
    Last Post: 5th January 2012, 11:39
  4. Replies: 2
    Last Post: 21st November 2010, 18:03
  5. print something on console application
    By cemtopkaya in forum Qt Programming
    Replies: 2
    Last Post: 10th June 2010, 13:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.