Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.2.0
-
None
-
Fails Windows 8 with Qt Creator 3, VS 2008, Qt 5.2.0
Works on Windows 8, VS 2008, Qt 4.8.5
Works on Macintosh 10.6.8 both Qt 4.8.5 and Qt 5.2.0
Description
Our application needs "grouped" windows- two windows that, when one is moved, the other follows. I implement this in Qt using eventFilter to monitor QEvent::Move events. The attached project is a very much simplified example.
When the event filter gets a move event, it computes a delta and moves the second window. In order to avoid recursion, a flag is set before the call to QWidget::move(), and unset after. If a move event is received while the flag is set, it blocks the event.
With Qt 4.8 this works fine on both Macintosh and Windows. On Macintosh with Cocoa, the movement is odd- the second window waits until the first stops moving. This is a consequence of Cocoa's event delivery, and is not an issue here.
With Qt 5.2 (I didn't check with previous Qt 5 versions) it works on Macintosh, but causes recursion on Windows. On both platforms, I see an extra move event when QWidget::move() is called.
Qt 4.8 sequence is
Receive move event for Window 1
set flag
move Window 2
Receive non-spontaneous move event as a result.
Block the move event in recursive call to eventFilter.
original call to move returns; unset the flag.
Qt 5.2.0 sequence on Macintosh:
Receive move event for Window 1
set the flag
move Window 2
Receive spontaneous move event for Window 1
Block the move event in recursive call to eventFilter.
Receive non-spontaneous move event for Window 1
Block the move event in recursive call to eventFilter (the flag is still set)
original call to move returns; unset the flag.
Qt 5.2.0 sequence on Windows:
Receive move event for Window 1
set the flag
move Window 2
Receive non-spontaneous move event for Window 1
Block the move event in recursive call to eventFilter.
original call to move returns; unset the flag.
Receive spontaneous move event for Window 1
FAIL TO BLOCK this event because the flag was unset above.
set the flag
move Window 1 in response to this unwanted event.
Receive non-spontaneous move event for Window 2
Block the move event in recursive call to eventFilter.
original call to move returns; unset the flag.
Receive spontaneous move event for Window 2
... and on and on ...
Since the flag was unset after QWidget::move returned, the second move event is not blocked. Note that the order of spontaneous and non-spontaneous events is reversed in the Windows case compared to Macintosh case. Note also that Qt 4.8 does NOT send a spontaneous event when QWidget::move is called; Qt 5.2.0 sends TWO events for a single call to QWidget::move, one spontaneous and one non-spontaneous. It seems like the spontaneous event is a bug.
Attachments
Issue Links
- duplicates
-
QTBUG-32590 two move events per move call, one in subsequent message loop
- Closed
- is replaced by
-
QTBUG-32590 two move events per move call, one in subsequent message loop
- Closed