Prevent to show default windows context menu in winEvent
-
Hi
I want to to get word under mouse cursor but when user right click in any window, default windows context menu appear, how can i prevent showing default windows context menu in winEvent in Qt?@bool EventReceiverWindow::winEvent (MSG *message,long *result )
{if( message->message == WM_RBUTTONUP ) { // *result = ? (What's value should i passed to *result to prevent showing defualt context menu) return true; }
}@
-
You don't need to reimplement winEvent for this. Just "setContextMenuPolicy":http://doc.qt.nokia.com/stable/qwidget.html#contextMenuPolicy-prop to Qt::NoContextMenu on your widget
-
It's not for my Qt App. i want to prevent default windows menu context for all other applications and also window.
-
[quote author="cincirin" date="1321011624"]Why you use WM_RBUTTONUP filter event ? This is fired when right mouse button is up. You should filter winEvent for WM_RBUTTONDOWN and set *result to zero.[/quote]
Default Windows Context menu is appeared when RBUTTONUP fired
-
I'm sorry. Somehow you are right. So you need to filter "WM_CONTEXTMENU":http://msdn.microsoft.com/en-us/library/windows/desktop/ms647592(v=vs.85).aspx and not WM_RBUTTONUP. About result, it should be
@
*result = DefWindowProc(message->hwnd, WM_CONTEXTMENU, message->wParam, message->lParam)
@