[Development] QWidget mouse events - different order

Rick Stockton rickstockton at reno-computerhelp.com
Thu Dec 19 18:36:57 CET 2013


<< SNIP >>
On 12/18/2013 06:30 PM, Nicolás Alvarez wrote:
> 2013/12/18 Andreas Aardal Hanssen <andreas at hanssen.name>:
>> 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.
> That would break many use cases, such as QSpinBox, which performs an
> action on every press (not release) and doesn't care about double
> click events.
>
Perhaps we should perform as QT4 did (there wasn't a second ButtonPress,
the DoubleClick "ate it"). Such use cases would then need to be "fixed
up" (i,e, to accept EITHER event as a cause for executing that Action)?
Logical, but a lot of work.

-- 
GPG fingerprint: 597E 4CE5 6D56 A7C2 DA3A 26FF F21F F828 0C86 165A




More information about the Development mailing list