本文介绍了如何在KDE的Qt应用程序中禁用自动助记符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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();
}

输出前面带有& :

在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应用程序中禁用自动助记符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 10:52