[Qt-interest] auto cancelling interaction when a dialog is shown (WM_CANCELMODE equivalent)?

Girish Ramakrishnan girish at forwardbias.in
Fri Feb 13 07:20:00 CET 2009


Hi,
There are some quirks in mouse event delivery (it depends on whether you
are processing events on a widget or window; on whether you popup a
modal or non-modal widget and so on).

Usually mouse release is always delivered to the widget that is the
mouse grabber (i.e the widget on which the mouse was intially pressed).
However, when new widgets/dialogs are created in mouse events, the mouse
release may or may not be delivered to the mouse grabber. Mouse move
events are delivered if the new window created is non-modal.

So: If you are processing mouseMove, write code that doesn't expect a
mouseRelease. QScrollBar does just that - it moves slider on mouseMove
and does not expect a mouseRelease. You will also see that instead of a
modal dialog, if you display something non-modal, the scroll bar will
continue to move.

Girish

Ross Bencina wrote:
> Hi Guys
> 
> I need to cancel interaction when I'm manipulating a custom widget and a
> dialog box is displayed (such as when the user hits Ctrl-N and the "Do
> you want to save?" message box is displayed while I'm manipulating a
> control with the left mouse button down).
> 
> The Qt Scroll Bar seems to cancel interaction when I hit a key to pop up
> a dialog while I'm dragging the scroll bar thumb, but my custom widgets
> get confused and never see a mouseRelease event.
> 
> On Win32 there's WM_CANCELMODE Notification for this purpose:
> http://msdn.microsoft.com/en-us/library/ms632615(VS.85).aspx
> 
> 
> Could someone please enlighten me as to what the equivalent event (or
> technique) is in Qt?
> 
> Thanks!
> 
> Ross.
> 
> 
> 
> 
> ===================================
> AudioMulch 2.0 coming soon!
> 
> http://www.audiomulch.com



More information about the Qt-interest-old mailing list