Results 1 to 3 of 3

Thread: QGraphicsScene core dump?

  1. #1
    Join Date
    Apr 2009
    Posts
    21
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QGraphicsScene core dump?

    Could someone please tell me what is wrong with this piece of code? I'm using Qt 4.5.3 on Unix/X11

    Qt Code:
    1. #include <QGraphicsView>
    2. #include <QGraphicsScene>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. s.addText("hello");
    7.  
    8. v.show();
    9.  
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 

    It gives me a core dump right after I declare a QGraphicsScene with the following backtrace.

    #0 QGraphicsScenePrivate::init (this=0x5012e0) at ../../include/QtGui/../../src/gui/kernel/qapplication.h:102
    102 #ifndef QT_NO_STYLE_STYLESHEET
    (gdb) where
    #0 QGraphicsScenePrivate::init (this=0x5012e0) at ../../include/QtGui/../../src/gui/kernel/qapplication.h:102
    #1 0x0000002a95e22e95 in QGraphicsScene (this=0x7fbffff610, parent=0x0) at graphicsview/qgraphicsscene.h:276
    #2 0x000000000040082f in main () at main.cpp:9
    Last edited by cookie1909; 24th April 2009 at 20:23.

  2. #2
    Join Date
    Apr 2009
    Posts
    21
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QGraphicsScene core dump?

    Well, I guess I have to have a parent window and an application ... Sorry my first post was dump :P

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6. QMainWindow window;
    7.  
    8. QGraphicsScene scene(&window);
    9. QGraphicsItem* item = scene.addText("hello");
    10.  
    11. QGraphicsView view(&window);
    12. view.setScene(&scene);
    13.  
    14. window.show();
    15. return app.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsScene core dump?

    You don't need the parent window. You need the application object though.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following user says thank you to wysota for this useful post:

    cookie1909 (27th April 2009)

Similar Threads

  1. Replies: 0
    Last Post: 5th March 2009, 06:54
  2. in QGraphicsScene matrix of other QGraphicsScene
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 15th February 2009, 17:27
  3. core dump
    By DadaLee in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th September 2008, 10:05
  4. openGL in Qtopia core
    By sar_van81 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 18th July 2008, 11:26
  5. QGraphicsScene segmentation fault
    By maxpower in forum Qt Programming
    Replies: 2
    Last Post: 20th November 2006, 18:28

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.