Results 1 to 3 of 3

Thread: QMenu action cursor type change

  1. #1
    Join Date
    Aug 2017
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QMenu action cursor type change

    I'm trying to change the cursor type for any grayed out menu items.
    So, for enabled menu action items, I'd like to have the cursor be pointing hand cursor.
    But for disabled menu action (grayed out) items, I'd like to change the cursor to an arrow cursor.
    I've connected to QAction::hovered(), and then in the slot for this signal, I set the menu's
    cursor appropriately depending on whether the action hovered on is enabled or not.
    This does not work. The cursor stays whatever it was before I hover over the menu action.
    I've added debug code to make sure that QMenu::setCursor call does get executed.

    Any ideas?

    Thank you all for any help.

    GUI Developer

  2. #2
    Join Date
    Jul 2008
    Posts
    379
    Thanks
    9
    Thanked 47 Times in 45 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu action cursor type change

    Hi, as far as I remember you don't get events/signals for disabled widgets.

    Ginsengelf

  3. #3
    Join Date
    Aug 2017
    Posts
    5
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMenu action cursor type change

    In the slot for hovered signal, I check the action to see if it is enabled.
    If it is enabled, I set the cursor for the menu to be pointing hand cursor.
    If it is not enabled, I set the cursor for the menu to be arrow cursor.

    But the mouse cursor does not change, even though the call to QMenu::setCrursor
    gets executed.

    GUI Developer

Similar Threads

  1. How to perform action on clicking a QMenu object only?
    By Sai Kamat in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2014, 13:35
  2. Replies: 11
    Last Post: 8th February 2013, 14:59
  3. Hide shorcut text of QMenu Action
    By KillGabio in forum Qt Programming
    Replies: 5
    Last Post: 19th January 2012, 10:43
  4. Hidden mouse cursor reappears when a QMenu is displayed
    By cristeab in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2011, 09:58
  5. QMenu still highligheted after action fired in mac
    By berinder in forum Qt Programming
    Replies: 2
    Last Post: 1st September 2008, 20:53

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.