PDA

View Full Version : view, paint, layout and qtimers not playing nicely together?



bjh
31st October 2007, 21:37
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

jacek
31st October 2007, 21:46
Do you have any static or global variables? Do you create any Qt objects before you instantiate QApplication?

bjh
1st November 2007, 20:20
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