Results 1 to 2 of 2

Thread: Disable left click menu on icon

  1. #1
    Join Date
    May 2014
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Disable left click menu on icon

    Hi everyone,

    I'd like to disable the menu displayed when you left-click on the icon of a QWidget.
    The thing is I thought it was a contextMenu since it's the same menu that is displayed but seems not...
    I tried to overload mousePressEvent, install a eventfilter... but with no success (nor did the search on google)

    The eventfilter works but not on the first attempt. By that I mean, on the first left click on the icon, it displays the menu but on the second click it's not available. But if you move your mouse and click on another pixel of the icon it displays the menu but not on the second etc...

    So if anyone has any idea...

    Edit:
    I tried using
    Qt Code:
    1. mSubWindow->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
    To copy to clipboard, switch view to plain text mode 
    But it also remove the icon and the close button (Qt::WindowSystemMenuHint being needed on my plateform obviously...)

    Or if not possible to disable the menu, is it possible to disable "move" and "size" of this menu actions instead?
    Last edited by atlantis210; 22nd December 2014 at 13:11.

  2. #2
    Join Date
    May 2014
    Posts
    7
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Disable left click menu on icon

    I succeeded to disable the left click menu by intercepting the event with an eventFilter. It didn't work at first because my eventFilter was set on the main widget and not on the child...
    Anyhow, it works.

Similar Threads

  1. Context menu long left click on QGraphicsTextItem
    By flavien317 in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2014, 09:27
  2. Linux, disable alt+left mouse press drag
    By aftos in forum Qt Programming
    Replies: 0
    Last Post: 21st March 2014, 08:43
  3. Replies: 4
    Last Post: 11th January 2014, 03:06
  4. Replies: 0
    Last Post: 24th August 2012, 09:29
  5. Replies: 7
    Last Post: 26th April 2012, 14:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.