On 12/18/2013 01:10 PM, Andreas Aardal Hanssen wrote: > On 18 Dec 2013, at 22:07, Rayner Pupo Gómez <[email protected]> wrote: Inner-most quote is from Martin Koller.
>>> 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 Andreas, I'm confirming the QT5 behavior, to be as Martin describe. BUT, the Qt4 behavior seems to be as YOU recall - no ButtonPress" at all for the fast-enough second click which invoked a "DoubleClick event. I used "qtbase/examples/widgets/widgets/mousebuttons" program (the executable is named "buttontester"). Running inside Qt Creator, with 5.2, output from double-clicking of "LeftButton" is: Starting /opt/Qt5.2.0/5.2.0/Src/qtbase/examples/widgets/widgets/build-mousebuttons-Desktop_Qt_5_2_0_GCC_64bit-Debug/buttontester... "Mouse Press: raw button=1 Qt=LeftButton heldbuttons LeftButton " "Mouse Release: raw button=1 Qt=LeftButton heldbuttons NoButton" "Mouse Press: raw button=1 Qt=LeftButton heldbuttons LeftButton " "Mouse DoubleClick: raw button=1 Qt=LeftButton heldbuttonsLeftButton " "Mouse Release: raw button=1 Qt=LeftButton heldbuttons NoButton" /opt/Qt5.2.0/5.2.0/Src/qtbase/examples/widgets/widgets/build-mousebuttons-Desktop_Qt_5_2_0_GCC_64bit-Debug/buttontester exited with code 0 But, Migrating the program back to 4.8.5 (just remove the include of Qtwidgets, and all the lines which test for buttons > Qt::MiddleButton) I confirm YOUR "AFAIR" behavior, and not the behavior in Martin's message: "Mouse Press: raw button=1 Qt=LeftButton heldbuttons LeftButton " "Mouse Release: raw button=1 Qt=LeftButton heldbuttons NoButton" "Mouse DoubleClick: raw button=1 Qt=LeftButton heldbuttonsLeftButton " "Mouse Release: raw button=1 Qt=LeftButton heldbuttons NoButton" Given the fact that many "single-click" programs involve rapid clicking, (they ignore the DoubleClick completely, and execute per the second MousePress) - IMO, we should provide both events, and write a doco change instead of revising the code to match Qt4 behavior. -- GPG fingerprint: 597E 4CE5 6D56 A7C2 DA3A 26FF F21F F828 0C86 165A
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
