Skip to content

Commit de72db0

Browse files
committed
Merge branch 'fix-issue-1077' into release
2 parents e714294 + 56fcb7d commit de72db0

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ include(FeatureSummary)
2525

2626
# Project declaration
2727

28-
project(Mapper VERSION 0.8.1 LANGUAGES CXX C)
28+
project(Mapper VERSION 0.8.1.1 LANGUAGES CXX C)
2929

3030
if(Mapper_VERSION_DISPLAY)
3131
message(STATUS "Custom version display string: \"${Mapper_VERSION_DISPLAY}\"")

src/gui/main_window.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2012, 2013, 2014 Thomas Schöps
3-
* Copyright 2012-2017 Kai Pastor
3+
* Copyright 2012-2018 Kai Pastor
44
*
55
* This file is part of OpenOrienteering.
66
*
@@ -255,10 +255,11 @@ 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)".
258+
// Defeat Qt's menu text heuristic, as a workaround for QTBUG-30812.
259+
// Changing an action's menu role (to QAction::NoRole) after it was
260+
// added to the menu is unsupported and triggers crashes (#1077).
261+
// Instead, we defeat the heuristic by adding a zero width space at the
262+
// beginning and the end of the text of every action in the menus.
262263
const auto menubar_actions = menuBar()->actions();
263264
for (auto action : menubar_actions)
264265
{
@@ -267,15 +268,13 @@ void MainWindow::setController(MainWindowController* new_controller, bool has_fi
267268
const auto menu_actions = menu->actions();
268269
for (auto action : menu_actions)
269270
{
270-
if (action->menuRole() == QAction::TextHeuristicRole)
271-
action->setMenuRole(QAction::NoRole);
271+
static const auto zwsp = QString::fromUtf8("\u200B");
272+
action->setText(zwsp + action->text() + zwsp);
272273
}
273274
}
274275
}
275276

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.)
277+
// Needed to activate the menu bar changes
279278
if (isVisible() && qApp->activeWindow() == this)
280279
{
281280
// Force a menu synchronisation,

0 commit comments

Comments
 (0)