For correct working menu on Mac OS X use menu roles.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-17 14:42:03 +02:00
parent 974a074ffd
commit dc1b593b4b
3 changed files with 152 additions and 5 deletions

View File

@ -647,7 +647,8 @@ void TMainWindow::FileSaveAs()
void TMainWindow::AboutToShowWindowMenu()
{
ui->menuWindow->clear();
ui->menuWindow->addAction(tr("&New Window"), this, SLOT(NewWindow()));
QAction *action = ui->menuWindow->addAction(tr("&New Window"), this, SLOT(NewWindow()));
action->setMenuRole(QAction::NoRole);
ui->menuWindow->addSeparator();
QList<TMainWindow*> windows = qApp->MainWindows();
@ -665,6 +666,7 @@ void TMainWindow::AboutToShowWindowMenu()
QAction *action = ui->menuWindow->addAction(title, this, SLOT(ShowWindow()));
action->setData(i);
action->setCheckable(true);
action->setMenuRole(QAction::NoRole);
if (window == this)
{
action->setChecked(true);
@ -1718,6 +1720,7 @@ void TMainWindow::SetupMenu()
connect(ui->actionDatabase, &QAction::triggered, qApp, &MApplication::ShowDataBase);
connect(ui->actionImportFromPattern, &QAction::triggered, this, &TMainWindow::ImportFromPattern);
actionDockDiagram = ui->dockWidgetDiagram->toggleViewAction();
actionDockDiagram->setMenuRole(QAction::NoRole);
ui->menuMeasurements->addAction(actionDockDiagram);
actionDockDiagram->setEnabled(false);

View File

@ -889,6 +889,9 @@
<property name="text">
<string>Open individual ...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSave">
<property name="enabled">
@ -902,6 +905,9 @@
<property name="text">
<string>Save</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSaveAs">
<property name="enabled">
@ -915,6 +921,9 @@
<property name="text">
<string>Save As ...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionQuit">
<property name="icon">
@ -925,11 +934,17 @@
<property name="text">
<string>Quit</string>
</property>
<property name="menuRole">
<enum>QAction::QuitRole</enum>
</property>
</action>
<action name="actionAboutQt">
<property name="text">
<string>About &amp;Qt</string>
</property>
<property name="menuRole">
<enum>QAction::AboutQtRole</enum>
</property>
</action>
<action name="actionAboutTape">
<property name="icon">
@ -940,6 +955,9 @@
<property name="text">
<string>About Tape</string>
</property>
<property name="menuRole">
<enum>QAction::AboutRole</enum>
</property>
</action>
<action name="actionNew">
<property name="icon">
@ -950,6 +968,9 @@
<property name="text">
<string>New</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionAddKnown">
<property name="enabled">
@ -962,6 +983,9 @@
<property name="text">
<string>Add known</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionAddCustom">
<property name="enabled">
@ -974,6 +998,9 @@
<property name="text">
<string>Add custom</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionReadOnly">
<property name="checkable">
@ -989,6 +1016,9 @@
<property name="text">
<string>Read only</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOpenStandard">
<property name="icon">
@ -999,6 +1029,9 @@
<property name="text">
<string>Open standard ...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOpenTemplate">
<property name="icon">
@ -1009,6 +1042,9 @@
<property name="text">
<string>Open template</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionDatabase">
<property name="text">
@ -1017,11 +1053,17 @@
<property name="toolTip">
<string>Show information about all known measurement</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionPreferences">
<property name="text">
<string>Preferences</string>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="actionImportFromPattern">
<property name="enabled">
@ -1030,6 +1072,9 @@
<property name="text">
<string>Import from a pattern</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionCreateFromExisting">
<property name="text">
@ -1041,6 +1086,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>

View File

@ -375,7 +375,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<width>117</width>
<height>58</height>
</rect>
</property>
@ -461,7 +461,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<width>117</width>
<height>156</height>
</rect>
</property>
@ -625,7 +625,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<width>117</width>
<height>196</height>
</rect>
</property>
@ -867,7 +867,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<width>117</width>
<height>58</height>
</rect>
</property>
@ -1358,6 +1358,9 @@
<property name="shortcut">
<string notr="true">Ctrl+N</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOpen">
<property name="icon">
@ -1377,6 +1380,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSave">
<property name="enabled">
@ -1399,6 +1405,9 @@
<property name="shortcut">
<string notr="true">Ctrl+S</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSaveAs">
<property name="enabled">
@ -1418,6 +1427,9 @@
<property name="shortcut">
<string notr="true">Ctrl+Shift+S</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionDraw">
<property name="checkable">
@ -1442,6 +1454,9 @@
<property name="shortcut">
<string notr="true">Ctrl+W</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionDetails">
<property name="checkable">
@ -1463,6 +1478,9 @@
<property name="shortcut">
<string notr="true">Ctrl+E</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionArrowTool">
<property name="checkable">
@ -1502,6 +1520,9 @@
<property name="shortcut">
<string notr="true">Ctrl+Shift+N</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOptionDraw">
<property name="enabled">
@ -1520,6 +1541,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionTable">
<property name="checkable">
@ -1541,6 +1565,9 @@
<property name="shortcut">
<string notr="true">Ctrl+T</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionHistory">
<property name="checkable">
@ -1559,6 +1586,9 @@
<property name="shortcut">
<string notr="true">Ctrl+H</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionLayout">
<property name="checkable">
@ -1580,6 +1610,9 @@
<property name="shortcut">
<string notr="true">Ctrl+L</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionAbout_Qt">
<property name="text">
@ -1588,6 +1621,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::AboutQtRole</enum>
</property>
</action>
<action name="actionAbout_Valentina">
<property name="icon">
@ -1601,6 +1637,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::AboutRole</enum>
</property>
</action>
<action name="actionExit">
<property name="icon">
@ -1617,6 +1656,9 @@
<property name="shortcut">
<string notr="true">Ctrl+Q</string>
</property>
<property name="menuRole">
<enum>QAction::QuitRole</enum>
</property>
</action>
<action name="actionPreferences">
<property name="text">
@ -1625,6 +1667,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="actionPattern_properties">
<property name="text">
@ -1633,6 +1678,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionZoomIn">
<property name="enabled">
@ -1652,6 +1700,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionZoomOut">
<property name="enabled">
@ -1671,6 +1722,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionEdit_pattern_code">
<property name="text">
@ -1679,6 +1733,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionZoomOriginal">
<property name="enabled">
@ -1698,6 +1755,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionZoomFitBest">
<property name="enabled">
@ -1714,6 +1774,9 @@
<property name="shortcut">
<string notr="true">Ctrl+=</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionStopTool">
<property name="checkable">
@ -1747,6 +1810,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionCloseWindow">
<property name="text">
@ -1755,6 +1821,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOnlineHelp">
<property name="icon">
@ -1771,6 +1840,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionLast_tool">
<property name="enabled">
@ -1785,6 +1857,9 @@
<property name="shortcut">
<string notr="true">L</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionShowCurveDetails">
<property name="checkable">
@ -1802,6 +1877,9 @@
<property name="shortcut">
<string notr="true">F2</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSaveAsPDF">
<property name="enabled">
@ -1943,6 +2021,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionLoadStandard">
<property name="enabled">
@ -1954,6 +2035,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionCreateNew">
<property name="text">
@ -1965,6 +2049,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionShowM">
<property name="enabled">
@ -1979,6 +2066,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionSyncMeasurements">
<property name="enabled">
@ -1994,6 +2084,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionUnloadMeasurements">
<property name="enabled">
@ -2008,6 +2101,9 @@
<property name="shortcut">
<string notr="true"/>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>