Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Prevent to show default windows context menu in winEvent

Prevent to show default windows context menu in winEvent

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Professionl
    wrote on last edited by
    #1

    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;
        }
    

    }@

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Professionl
        wrote on last edited by
        #3

        It's not for my Qt App. i want to prevent default windows menu context for all other applications and also window.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Professionl
            wrote on last edited by
            #5

            [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

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cincirin
              wrote on last edited by
              #6

              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)
              @

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved