[Development] QWidget mouse events - different order
Andreas Aardal Hanssen
andreas at hanssen.name
Wed Dec 18 22:10:00 CET 2013
On 18 Dec 2013, at 22:07, Rayner Pupo Gómez <rpgomez at uci.cu> wrote:
>> I've discovered that with Qt5 I get a different order of mouse events on
>> a QWidget than with Qt4 (openSuse 13.1 Linux, X11):
>> double clicking a widget results in Qt4 in:
>> mousePressEvent
>> mouseReleaseEvent
>> mouseDoubleClickEvent
>> mousePressEvent
>> mouseReleaseEvent
>> but in Qt5 in:
>> mousePressEvent
>> mouseReleaseEvent
>> mousePressEvent
>> mouseDoubleClickEvent
>> mouseReleaseEvent
>> I tested with Qt4.8.5 and Qt5.2.
>> Is this behavioral change intended, undefined, a bug ?
>> (it results in my app not behaving as before ...)
>> --
>
> I think it's a mistake to rely on the order of this kind of events, there are
> fired asynchronously, your logic cant depend on this
Wrong! The order is very essential and can and must be relied on.
The behaviour in Qt 5 is questionable. I believe the double-click must come first to be able to distinguish from two presses.
I also wonder if it’s accurate / true that Qt 4 sends the second press after the double-click. AFAIR:
Press
Release
DoubleClick
Release
Is the right events for double-clicking.
Andreas
More information about the Development
mailing list