[Development] QWidget mouse events - different order

Martin Koller kollix at aon.at
Fri Dec 20 08:31:24 CET 2013


On Thursday 19 December 2013 09:19:38 Rick Stockton wrote:
> On 12/18/2013 01:10 PM, Andreas Aardal Hanssen wrote:
> > On 18 Dec 2013, at 22:07, Rayner Pupo Gómez <rpgomez at uci.cu> 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'm not making things up. This is what my testprogram gives.
I attach it here.

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: press.cxx
Type: text/x-c++src
Size: 818 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131220/365894ad/attachment.cxx>


More information about the Development mailing list