How to disable automatic mnemonics in a Qt application on KDE?
Asked Answered
U

2

10

In any Qt application on KDE when I add a QPushButton in designer and check it's text by:

void MainWindow::on_pushButton_clicked()
{
    qDebug()<<ui->pushButton->text();
}

The output is preceded by an & :

&PushButton

This behavior does not exist on Windows. It seems that Qt applications on KDE automatically add shortcuts to all push buttons, which is not desired for me. I should note that the ampersands are not created by designer and you can not see them in the.ui file. Actually when the button is added to a widget, an & is placed somewhere in it's text.

Is it possible to disable automatic mnemonics of a Qt application in anyway?

Unstudied answered 21/9, 2015 at 5:50 Comment(4)
This question is unclear. Does Qt Designer add these? Are they present in the .ui file? Are they added at runtime by Qt itself? You really need to make it clear.Geometric
@KubaOber The ampersands are not created by designer and you can not see them in .ui. It seems that when the button in added to a widget, an & is placed somewhere in it's text. Maybe that's the behavior of KDE.Unstudied
Please put such clarifications in the question.Geometric
Went through this issue too... It occurred with plasma 5 and qt 5.5. No problem with kde 4 and qt 5.5.Chitchat
S
19

KDEPlatformTheme plugin responsible for it.

A workaround is to add

[Development]
AutoCheckAccelerators=false

to ~/.config/kdeglobals, which prevents KDE from automatically adding accelerators.

Related bug: https://bugs.kde.org/show_bug.cgi?id=337491

Snuck answered 22/9, 2015 at 8:0 Comment(0)
A
0

I had this problem using KDE Plasma 6.0.5, while updating and testing Qt code. The workaround in kdeglobals solved it !

Amalia answered 7/6 at 15:52 Comment(1)
Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From ReviewSerration

© 2022 - 2024 — McMap. All rights reserved.