Results 1 to 3 of 3

Thread: view, paint, layout and qtimers not playing nicely together?

  1. #1
    Join Date
    Sep 2007
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default view, paint, layout and qtimers not playing nicely together?

    Hi All,

    I have a QGraphicsView inside of a QGridLayout, which is inside of another QGridLayout. The custom paint() function only seems to be getting called when I manually adjust the size of the displayed window, despite the call to paint() changing the size of what is drawn. Is this related to the view being inside of nested layouts?

    Possibly related is a warning message that appears on the console - "QTimer can only be used with threads started with QThread". I am trying to use a QTimer set for 1 second to repeatedly signal a slot function to do something else, which also doesn't show in the view until I manually change the size. My main() uses a QApplication app, which does a "return app.exec()". Is there some way I'm supposed to manually create a QThread?

    I'm pretty confused; any assistance will be greatly appreciated!


    bjh

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: view, paint, layout and qtimers not playing nicely together?

    Do you have any static or global variables? Do you create any Qt objects before you instantiate QApplication?

  3. The following user says thank you to jacek for this useful post:

    bjh (1st November 2007)

  4. #3
    Join Date
    Sep 2007
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: view, paint, layout and qtimers not playing nicely together?

    Hi jacek! That was exactly the problem - one global variable, and one Qt object was created before instantiating QApplication. Thank you!

    Your assistance is very much appreciated. Qt has a steeper learning curve than anticipated! :-)


    bjh

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.