0

I am using Qt 5.11.1 on Manjaro Linux. When I open Qt Designer, create a new dialog and add stuff on the widget, Qt Designer adds '&' (ampersand) in the text in some types of widgets automatically. (Ampersand "&" is shortcut in Qt, commonly referred to as "mnemonic". For example, if text of button is "b&utton", I can click the button with Alt + U. See this answer for more information.) For example, if I create a radio button and set the text to "button", the text will become "b&utton" automatically, and I cannot remove the '&'. What should I do?

cges30901
  • 470
  • 3
  • 10

2 Answers2

1

Not sure, probably qt_set_sequence_auto_mnemonic function is what you are looking for.

Specifies whether mnemonics for menu items, labels, etc., should be honored or not. On Windows and X11, this feature is on by default; on macOS, it is off. When this feature is off (that is, when b is false), QKeySequence::mnemonic() always returns an empty string.

Note: This function is not declared in any of Qt's header files. To use it in your application, declare the function prototype before calling it.

Community
  • 1
  • 1
Andrii
  • 1,788
  • 11
  • 20
  • Sorry, I don't know how to use it. But the workaround in https://stackoverflow.com/questions/32688153/how-to-disable-automatic-mnemonics-in-a-qt-application-on-kde works. Thank you very much for providing the link! – cges30901 Jul 05 '18 at 10:58
1

The workaroud in How to disable automatic mnemonics in a Qt application on KDE? works. Thank you Andrii for providing the link! The workaroud is to add

[Development]
AutoCheckAccelerators=false

to ~/.config/kdeglobals.

I also found that removing the package kdelibs4support is also a workaround, but some packages might depend on it.

cges30901
  • 470
  • 3
  • 10