[Kde-games-devel] does this solve the multiple resizing bug for you?
Wolfgang Rohdewald
wolfgang at rohdewald.de
Wed May 6 05:26:58 CEST 2009
I found something that works for me:
1. in the KXMLGuiWindow constructor fire a singleShot Timer. 1 msec is sufficient.
2. define a corresponding event that fires another singleShot Timer. 1 msec is sufficient.
3. define a corresponding event that finally allows the resizing method
to do something.
this only takes 2 msec, and it does not have the drawback that an empty window appears when
the first QGraphicsView constructor is executed.
the first timer prevents one resize for starting with normal window sizes
the second timer prevents the extra resize for starting with a maximized window size.
This works here with qt4.5.0 and kde4.2.2. So I have some uncertainties:
- does it work with other versions?
- does it also work in a C++ program?
- why does it work at all? I have no idea. I just saw that Alan Alpert posted a patch
for KAtomic using timers, so I experimented with timers.
- are there still special cases with more than one resize?
My class PlayField inherits from KXMGuiWindow.
In its constructor:
self.mayResize = False
QTimer.singleShot(1, self.timeout)
additional methods:
def timeout(self):
QTimer.singleShot(1, self.timeout2)
def timeout2(self):
self.mayResize = True
self.centralView.resizeEvent(True)
class FittingView inherits from QGraphicsview.
Its resizeEvent method ignores the event parameter and does nothing as long as
playField.mayResize is False.
--
Wolfgang
More information about the kde-games-devel
mailing list