PDA

View Full Version : resize problem, example and document not correct?



zhxys
21st January 2011, 10:16
In qt document, it wrote:
Warning: Calling resize() or setGeometry() inside resizeEvent() can lead to infinite recursion.

but when I debug this, for example, making some breakpoints inside resizeEvent(), which calls setGeometry(), it doesn't cause the infinite loop. I use carbide and symbian sdk plus qt 4.7.

Further more: IF it causes infinite loop, why below example from forum nokia deosn't?
http://wiki.forum.nokia.com/index.php/Dynamic_Layout_handling_with_QWidget

It has same kind of mechnism, when the resize event comes, it goes to the QtEggAlarm::eventFilter first, then the function SetScreenSizeAndPosition is called, inside, it resets the geometry, then it will trigger anther resize event, which will go to filter again....

so my conclusion is that the qt document is wrong?

tbscope
21st January 2011, 10:31
If you believe that part of the documentation is wrong, feel free to ignore it.

However, it is NOT wrong.
The recursion doesn't happen because the size stops changing in the example you mention, thus there's no second (or third?) resize event.

The docs clearly state "can"