mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: set menu role for certain actions
On macOS, OS will try to merge some actions to the application menu by text matching, which will be broken in Chinese. So we need to set these actions' role specifically, including: settings, exit, about, about QT.
This commit is contained in:
parent
9f4ac1f260
commit
96ac582253
@ -347,11 +347,13 @@ void VMainWindow::initHelpMenu()
|
|||||||
|
|
||||||
QAction *aboutAct = new QAction(tr("&About VNote"), this);
|
QAction *aboutAct = new QAction(tr("&About VNote"), this);
|
||||||
aboutAct->setToolTip(tr("View information about VNote"));
|
aboutAct->setToolTip(tr("View information about VNote"));
|
||||||
|
aboutAct->setMenuRole(QAction::AboutRole);
|
||||||
connect(aboutAct, &QAction::triggered,
|
connect(aboutAct, &QAction::triggered,
|
||||||
this, &VMainWindow::aboutMessage);
|
this, &VMainWindow::aboutMessage);
|
||||||
|
|
||||||
QAction *aboutQtAct = new QAction(tr("About &Qt"), this);
|
QAction *aboutQtAct = new QAction(tr("About &Qt"), this);
|
||||||
aboutQtAct->setToolTip(tr("View information about Qt"));
|
aboutQtAct->setToolTip(tr("View information about Qt"));
|
||||||
|
aboutQtAct->setMenuRole(QAction::AboutQtRole);
|
||||||
connect(aboutQtAct, &QAction::triggered,
|
connect(aboutQtAct, &QAction::triggered,
|
||||||
qApp, &QApplication::aboutQt);
|
qApp, &QApplication::aboutQt);
|
||||||
|
|
||||||
@ -537,6 +539,7 @@ void VMainWindow::initFileMenu()
|
|||||||
QAction *settingsAct = newAction(QIcon(":/resources/icons/settings.svg"),
|
QAction *settingsAct = newAction(QIcon(":/resources/icons/settings.svg"),
|
||||||
tr("&Settings"), this);
|
tr("&Settings"), this);
|
||||||
settingsAct->setToolTip(tr("View and change settings for VNote"));
|
settingsAct->setToolTip(tr("View and change settings for VNote"));
|
||||||
|
settingsAct->setMenuRole(QAction::PreferencesRole);
|
||||||
connect(settingsAct, &QAction::triggered,
|
connect(settingsAct, &QAction::triggered,
|
||||||
this, &VMainWindow::viewSettings);
|
this, &VMainWindow::viewSettings);
|
||||||
|
|
||||||
@ -548,6 +551,7 @@ void VMainWindow::initFileMenu()
|
|||||||
QAction *exitAct = new QAction(tr("&Exit"), this);
|
QAction *exitAct = new QAction(tr("&Exit"), this);
|
||||||
exitAct->setToolTip(tr("Exit VNote"));
|
exitAct->setToolTip(tr("Exit VNote"));
|
||||||
exitAct->setShortcut(QKeySequence("Ctrl+Q"));
|
exitAct->setShortcut(QKeySequence("Ctrl+Q"));
|
||||||
|
exitAct->setMenuRole(QAction::QuitRole);
|
||||||
connect(exitAct, &QAction::triggered,
|
connect(exitAct, &QAction::triggered,
|
||||||
this, &VMainWindow::close);
|
this, &VMainWindow::close);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user