[Qt-interest] Deleting a form in a double-click causes click to be emitted in the following release

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Fri May 22 05:37:10 CEST 2009


Hi Everybody, 

I have the following scenario: 

- The application displays a list of tests that the user is eligible to perform. 
- The user can double-click one of the tests to start it. 
- The selection form is deleteLater'd in the double-click handler, and a new form with the first question of the test is shown. 
- The release from the double-click then emits a click in the test form, possibly causing an incorrect answer to be selected. 
- The teacher complains because the software appears to be preselecting answers in the test! 

I have tried: 

- Calling processEvents in the double-click handler. This doesn't help, since the release hasn't happened yet. 

- Calling singleShot with a short time-out doesn't help if the user is configured with a long time-out. 
- Calling singleShot with the double-click timeout + 100 makes the application appear sluggish. 

I have resorted to just setting a flag in the double-click handler, and checking for it in the release event, then doing the form switch.  This works, but seems a hack, since everywhere else, a double-click responds on the press, not the release. 

I think the Qt event loop should not deliver the double-click release if the mouse has not moved, but  the current widget has changed. 

Should I raise a bug? 

Regards, 

Tony.





More information about the Qt-interest-old mailing list