[英]Disable “Start Dictation” for an app in Qt
Is there a way to disable "Start Dictation" for a mac application? 有没有办法为Mac应用程序禁用“启动听写”功能? Basically, I am getting "Start Dictation..." menu in "Edit" Menu bar repeatedly.
基本上,我在“编辑”菜单栏中反复出现“开始听写...”菜单。 Any work around will be helpful.
周围的任何工作都将有所帮助。
Changing the title property of your QMenu will prevent OS X from auto-adding silly things to your Edit menu. 更改QMenu的title属性将阻止OS X将愚蠢的东西自动添加到“编辑”菜单中。
So if I have a QMenuBar and I'm adding menus to it.. 因此,如果我有QMenuBar并向其中添加菜单。
m_edit = this->addMenu(tr(" Edit"));
Notice I put a space in front of the text. 注意,我在文本前面放置了一个空格。
You need to rename your menus to stop macOS messing with them. 您需要重命名菜单以阻止macOS混乱它们。 Adding a space in front of the menu item works, but it is a bit ugly.
在菜单项的前面添加一个空格是可行的,但这有点难看。 This is a classier way to do it using a zero width character:
这是使用零宽度字符的一种更经典的方法:
menu->setTitle( menu->title().prepend( QString::fromUtf8( "\u200C" ) ) );
You can do it for all your top-level application menus like this in your QMainWindow derived class (tested on Qt 4.7): 您可以在QMainWindow派生类中对所有此类顶级应用程序菜单执行此操作(已在Qt 4.7上测试):
#ifdef Q_OS_MACX
foreach ( QMenu* menu, menuBar()->findChildren<QMenu*>() )
{
menu->setTitle( menu->title().prepend( QString::fromUtf8( "\u200C" ) ) );
}
#endif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.