Solved Action shortcut missing in context menu
-
Hi @Rory_1, welcome!
Honestly, I'm not aware of an application showing shortcuts in a context menu. Most likely because of that, no such mechanism is implemented in Qt. But that is just guessing.
Also, it looks like your context menu contains the same items as you main menu. But usually, a context menu contains context sensitive items, i.e. items that only apply at the position where the menu was opened.
-
@aha_1980 said in Action shortcut missing in context menu:
Hi @Rory_1, welcome!
Honestly, I'm not aware of an application showing shortcuts in a context menu. Most likely because of that, no such mechanism is implemented in Qt. But that is just guessing.
This question shows it is possible: https://forum.qt.io/topic/82367/adding-more-actions-to-the-context-menu-of-a-spreadsheet-app
Also, it looks like your context menu contains the same items as you main menu. But usually, a context menu contains context sensitive items, i.e. items that only apply at the position where the menu was opened.
Understood. My app is designed to hide the main menu for a more compact form and for the menu to be accessible during slideshow mode, where only the image is visible.
-
@Rory_1 said in Action shortcut missing in context menu:
This question shows it is possible: https://forum.qt.io/topic/82367/adding-more-actions-to-the-context-menu-of-a-spreadsheet-app
Why don't you download its source and have a look at how it achieves it, then?
-
@JonB said in Action shortcut missing in context menu:
@Rory_1 said in Action shortcut missing in context menu:
This question shows it is possible: https://forum.qt.io/topic/82367/adding-more-actions-to-the-context-menu-of-a-spreadsheet-app
Why don't you download its source and have a look at how it achieves it, then?
I did, but I don't see why it is working in that example based on looking at the code. I haven't been able to get the project to run yet to confirm it actually does what the image suggests though.
-
@Rory_1
I don't know, but your screenshot looks different from that example. Is it possible that this uses a native OS/UI/desktop functionality to display the context menu, and that works for the icon on some other OS but not yours? -
That's a good point. I'll fiddle around with my style sheet to see if it is the culprit.
-
@JonB
I tried without my style sheet and I still get the same thing so that does not appear to be the issue. -
@Rory_1
Are you Qt 5.10? Are you https://github.com/lxde/lxqt/issues/1426 ?? -
@JonB said in Action shortcut missing in context menu:
@Rory_1
Are you Qt 5.10? Are you https://github.com/lxde/lxqt/issues/1426 ??Yes, I am on 5.10 and that appears to be the issue - thanks for finding it!! Seems like an odd "improvement". I really appreciate the help.
BTW I did get the spreadsheet app to run and I did not see the shortcuts.
-
@Rory_1
:)BTW I did get the spreadsheet app to run and I did not see the shortcuts.
Probably also requires the fix for your 5.10.
-
Right.
I hate to mark this issue as solved, but if that's the way Qt is going I guess I'll just have to live with it. I'll take a look at subclassing QStyleHints.
-
@Rory_1
As per http://doc.qt.io/qt-5/qstylehints.html#showShortcutsInContextMenus-prop, this is a deliberately-introduced option now. -
I understand - doesn't mean I have to agree with it. I've been thinking about how I would go about subclassing QStyleHints. I know how to subclass a widget that I can then use, but how do I subclass something I am not calling myself. Do I have to subclass QGuiApplication? Seems like that might be risky.
-
@Rory_1
Hi
Its being debated.
https://bugreports.qt.io/browse/QTBUG-61181?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true
So there might come a Set method. Currently its read only :( -
@mrjj
Thanks for the info. Much appreciated.