Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
356 views
in Technique[技术] by (71.8m points)

c++ - How to disable automatic mnemonics in a Qt application on KDE?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...