Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Prevent to show default windows context menu in winEvent

    General and Desktop
    2
    6
    3127
    Loading More Posts
    • 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
      Professionl last edited by

      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 Reply Quote 0
      • C
        cincirin last edited by

        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 Reply Quote 0
        • P
          Professionl last edited by

          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 Reply Quote 0
          • C
            cincirin last edited by

            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 Reply Quote 0
            • P
              Professionl last edited by

              [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 Reply Quote 0
              • C
                cincirin last edited by

                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 Reply Quote 0
                • First post
                  Last post