[Qt-interest] Ignoring double-click in different widgets
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Fri Jul 24 04:57:22 CEST 2009
Thanks to those for replying, and sorry for the delay getting back.
John & Christopher: I've tried adding a delay, but it makes the application
feel very sluggish.
Arnold: 'Educate users not to double-click'? I hope your are joking! The
application is used by school kids, and even older people like myself whose
fingers just don't always work as expected ;O) Disabling the entire form
for half a second would lead to nasty flashing.
I'll try overiding QApplication.event() and report back on the results.
Tony
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Tony Rietwyk
> Sent: Friday, 17 July 2009 18:32
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] Ignoring double-click in different widgets
>
>
> Hi Everybody,
>
> I have a large application with many forms in it. Clicking
> the OK button on form 1, closes form 1, then opens form 2.
> If the user double-clicks the button, then the second click
> occurs on form2 on whatever control happens to be at the same
> location.
>
> The application is used to generate examination questions for
> students to answer. So on many forms it is really important
> that the second click does NOT change the state of the second form.
>
> Is there an easy way in QApplication to ignore the second
> click, if it is within the double-click timeout, but when the
> current widget is different?
>
> I was thinking of subclassing QApplication, adding event()
> override, listening for mouse down and maintaining a QPointer
> to the last clicked widget, and the timestamp. I am unsure
> whether discarding the second click might create problems for
> other situations like when the mouse is grabbed, or menu
> pop-ups need to be cancelled.
>
> I am also not sure whether event() is the right method to
> override in this case.
>
> Any other suggestions gladly accepted!
>
> I'm running 4.5.0 on XP sp3, though I am sure the same
> problem existed in 4.3 & 4.4.
>
> Tony.
More information about the Qt-interest-old
mailing list