问题描述
在 KDE 上的任何 Qt 应用程序中,当我在设计器中添加 QPushButton
并通过以下方式检查其文本时:
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 &
:
&按钮
此行为在 Windows 上不存在.似乎 KDE 上的 Qt 应用程序会自动为所有按钮添加快捷方式,这对我来说并不理想.我应该注意,& 符号不是由设计者创建的,您在 .ui
文件中看不到它们.实际上,当按钮被添加到一个小部件时,一个 &
被放置在它的文本中的某个地方.
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.
是否可以禁用 Qt 应用程序的自动助记符?
Is it possible to disable automatic mnemonics of a Qt application in anyway?
推荐答案
KDEPlatformTheme 插件负责它.
KDEPlatformTheme plugin responsible for it.
解决方法是添加
[Development]
AutoCheckAccelerators=false
到~/.config/kdeglobals
,防止KDE自动添加加速器.
to ~/.config/kdeglobals
, which prevents KDE from automatically adding accelerators.
相关错误:https://bugs.kde.org/show_bug.cgi?id=337491
这篇关于如何在 KDE 上的 Qt 应用程序中禁用自动助记符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!