[Interest] Sequence of events in a double click
Schimkowitsch Robert
Robert.Schimkowitsch at andritz.com
Thu Sep 4 08:53:53 CEST 2025
Thank you so much John. I was socialized with Qt 4, and this explains exactly the disconnect between my mental model and reality.
Surprisingly, none of my code broke because of that second new press in Qt5, so I never noticed that.
Cheers
Robert
From: Interest <interest-bounces at qt-project.org> On Behalf Of John Weeks
Sent: Wednesday, 3 September 2025 19:37
To: interest at qt-project.org
Subject: Re: [Interest] Sequence of events in a double click
CAUTION: External email. Do not click on links or open attachments unless you know the sender and that the content is safe.
There is a flag that alerts you to the fact that the second MousePressEvent is the second of a double-click. Here is our code to handle it:
if (event->flags() & Qt::MouseEventCreatedDoubleClick) {
return;
}
And, yes, that was a change between Qt 4 and Qt 5 that caused us quite a bit of grief.
-John Weeks
WaveMetrics, a division of Sutter Instrument, Inc.
On 9/3/2025 6:14 AM, Axel Spoerl via Interest wrote:
Servus Robert,
Just to clarify: Indeed, the behavior is intended.
I am already old ��
:wq
Axel
Confidential
________________________________
From: Interest <interest-bounces at qt-project.org><mailto:interest-bounces at qt-project.org> on behalf of Schimkowitsch Robert <Robert.Schimkowitsch at andritz.com><mailto:Robert.Schimkowitsch at andritz.com>
Sent: Wednesday, 3 September 2025 14:26
To: interest at qt-project.org<mailto:interest at qt-project.org> <interest at qt-project.org><mailto:interest at qt-project.org>
Subject: Re: [Interest] Sequence of events in a double click
Hi Axel,
thanks for that pointer. I can now follow how QGuiApplicationPrivate::processMouseEvent() first receives the events, detects that an event is a double click, then calls my filter with the original event, and then calls my filter again with an extra double click event in case of a double click. So I guess this is intended behavior.
That said, I use Qt since 2009, so either things have changed sometimes between then and 2017, or the behavior was subtly different when only observing events on the widget or graphics view level. With an event filter, I am of course much lower-level.
I’m getting old...
Kind regards
Robert
From: Interest <interest-bounces at qt-project.org><mailto:interest-bounces at qt-project.org> On Behalf Of Axel Spoerl via Interest
Sent: Wednesday, 3 September 2025 13:42
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: Re: [Interest] Sequence of events in a double click
CAUTION: External email. Do not click on links or open attachments unless you know the sender and that the content is safe.
Servus Robert,
QGuiApplication::processMouseEvent() consumes the second mouse press event and sends an additional QEvent::Type::MouseButtonDblClick if the time between two presses is within the double click interval (QGuiApplication::styleHints()->mouseDoubleClickInterval()).
That said, when the second press event is received, Qt doesn't know if it meets the criteria for a double click.
The second press event has been sent for as long as I remember. That is, according to git blame, at least since 2017 ;-)
Cheers
Axel
Confidential
________________________________
From: Interest <interest-bounces at qt-project.org<mailto:interest-bounces at qt-project.org>> on behalf of Schimkowitsch Robert <Robert.Schimkowitsch at andritz.com<mailto:Robert.Schimkowitsch at andritz.com>>
Sent: Wednesday, 3 September 2025 11:43
To: interest at qt-project.org<mailto:interest at qt-project.org> <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Sequence of events in a double click
A small correction: “ButtonDoubleRelease” does not exist. It should read “ButtonRelease”
From: Interest <interest-bounces at qt-project.org<mailto:interest-bounces at qt-project.org>> On Behalf Of Schimkowitsch Robert
Sent: Wednesday, 3 September 2025 11:21
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: [Interest] Sequence of events in a double click
CAUTION: External email. Do not click on links or open attachments unless you know the sender and that the content is safe.
Hi all,
when you perform a double click on a mouse button (=pressing and releasing the mouse button in fast sequence twice), I have, over many years, always expected this sequence:
ButtonPress
ButtonRelease
ButtonDoublePress
ButtonDoubleRelease
It is consistent with what I get when I trace the window events using Spy++ (on Windows, for context) on a simple application (not my own, since Spy++ crashes when encountering the hooks of a serious Qt application, and I currently don’t have a good replacement tool).
However, in my Qt 6.8.2 application using a window event filter, I receive the following sequence:
ButtonPress
ButtonRelease
ButtonPress
ButtonDoublePress
ButtonDoubleRelease
The extra press confuses me. Is this as it should be?
Kind regards
Robert
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
https://lists.qt-project.org/listinfo/interest
________________________________
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
Thank You
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20250904/0dbe7e9d/attachment.htm>
More information about the Interest
mailing list