Skip to content

Commit b3cd92c

Browse files
committed
Revert "MainWindow (macOS): Disable menu text heuristics"
This reverts commit 96950e0. Changing the menu role after adding an action to the menu is unsupported by Qt and seems to be the trigger for the crashes reported in issue #1077.
1 parent e714294 commit b3cd92c

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/gui/main_window.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -255,27 +255,6 @@ void MainWindow::setController(MainWindowController* new_controller, bool has_fi
255255
createHelpMenu();
256256

257257
#if defined(Q_OS_MACOS)
258-
// Disable all menu text heuristics, as a workaround for QTBUG-30812.
259-
// Note that QAction::NoRole triggers QTBUG-29051,
260-
// warnings in QCocoaMenuItem::sync() about menu items having
261-
// "unsupported role QPlatformMenuItem::MenuRole(NoRole)".
262-
const auto menubar_actions = menuBar()->actions();
263-
for (auto action : menubar_actions)
264-
{
265-
if (const auto menu = action->menu())
266-
{
267-
const auto menu_actions = menu->actions();
268-
for (auto action : menu_actions)
269-
{
270-
if (action->menuRole() == QAction::TextHeuristicRole)
271-
action->setMenuRole(QAction::NoRole);
272-
}
273-
}
274-
}
275-
276-
// Probably related to QTBUG-62260.
277-
// But even with Qt 5.9.3, the "Mapper" menu is not correct initially.
278-
// (In Czech translation, the Settings menu is missing initially.)
279258
if (isVisible() && qApp->activeWindow() == this)
280259
{
281260
// Force a menu synchronisation,

src/gui/map/map_editor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ void MapEditorController::createActions()
871871

872872
show_grid_act = newCheckAction("showgrid", tr("Show grid"), this, SLOT(showGrid()), "grid.png", QString{}, "grid.html");
873873
configure_grid_act = newAction("configuregrid", tr("Configure grid..."), this, SLOT(configureGrid()), "grid.png", QString{}, "grid.html");
874+
#if defined(Q_OS_MACOS)
875+
configure_grid_act->setMenuRole(QAction::NoRole);
876+
#endif
874877
pan_act = newToolAction("panmap", tr("Pan"), this, SLOT(pan()), "move.png", QString{}, "view_menu.html");
875878
move_to_gps_pos_act = newAction("movegps", tr("Move to my location"), this, SLOT(moveToGpsPos()), "move-to-gps.png", QString{}, "view_menu.html");
876879
move_to_gps_pos_act->setEnabled(false);

0 commit comments

Comments
 (0)