QTabBar disable auto shortcuts
I have an application which has a lot of shortcuts, many of them able to be specified by the user. For historical reasons, some of these shortcuts are
Additionally, my application uses tabs as the primary interface, and I have run into an issue that I can't seem to work around.
QTabBar seems to auto-magically create keyboard shortcuts for the tab, even though they do not have any
&characters in them.
For example, if I have two tabs with the text:
Untitled_1, the result is that the first tab is connected to a shortcut of
Alt+Uand the second is connected to
Alt+1. This is in contrast to the documentation which says I should expect this behavior if the text was
QKeySequence::mnemonicis, in fact, returning an empty
QKeySequenceobject for the tab text being provided; so I don't understand where these shortcuts are coming from :-/. I have tried playing with
qt_set_sequence_auto_mnemonicto no success. If I wrap operations which create/update tabs with:
qt_set_sequence_auto_mnemonic(false); // do work qt_set_sequence_auto_mnemonic(true);
I see no difference in behavior. Alternatively, if I just do
qt_set_sequence_auto_mnemonic(false)at program start, this does seem to disable the shortcuts in the tabs... but also breaks all my menu shortcuts (dispite still displaying the underlines as if they would work!)
Is there a solution that will let me disable these keyboard shortcuts in a
QTabBarwithout me having to roll an entirely custom one?
I found the culprit, and it is not Qt's fault, it is KDE's!
KDEPlatformThemewill automatically adjust accelerators... which personally, I don't like. It can be worked around with:
I will look for a better solution, but in the KDE forums ;-).
Glad you found a workaround. It would nevertheless be nice to report back here when you get more information. Others may be interested in this topic also.