PDA

View Full Version : QMenu action cursor type change



GUIDeveloper
29th November 2018, 21:02
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

Ginsengelf
30th November 2018, 07:08
Hi, as far as I remember you don't get events/signals for disabled widgets.

Ginsengelf

GUIDeveloper
30th November 2018, 14:53
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