Hello,
Calling update() from paintEvent() handler results in interesting behavior under MS Windows (in Mac OS X and Linux everything is ok). For example, I want to make simple animation, like in demos/composition/. For doing animation I will call update() function in the end of paintEvent() handler to force next repaint. In paintEvent() i will use current time to sync animation. This way demos/composition/ works, as I understand.
It works very good, but when I'm pushing left mouse button down on window caption, animation stops. Animation resumes if I began to drag window. The same situation is with resize. When I release mouse button everything is ok again.
Calling update() from paintEvent() is just an example. Actually I need to emit some signals from other thread (using QueuedConnection) to GUI thread. But those signals doesn't reach slots when left mouse is down on window caption. But they all will reach slots when I release mouse button. Problem looks the same for me, but the first one is easy to reproduce.
Anyone know what is going on?
To reproduce bug you can take examples/widgets/analogclock/. Comment line
timer->start(1000);
timer->start(1000);
To copy to clipboard, switch view to plain text mode
in the constructor (AnalogClock::AnalogClock(QWidget *parent))
in analogclock.cpp. In void AnalogClock:aintEvent(QPaintEvent *) call update() in the end of this function. And the last, make time variable in paintEvent() static, like this:
static QTime time(1,
1,
1);
time = time.addSecs(30);
static QTime time(1, 1, 1);
time = time.addSecs(30);
To copy to clipboard, switch view to plain text mode
Thats all.
actually I don't need any animation. This case is just an example of how to reproduce the situation. I want to know why Qt signal-slot mechanism acts this way when I am pressing left mouse button on window caption. What I really need is to be able to send signals from some thread to GUI thread (yes, via Queued Connection) and to be sure that slots will be called while I am holding this left mouse button down. Now slots will be called for all signals when I will release the mouse button.
Bookmarks