Skip to content

Commit

Permalink
Merge branch 'fix-issue-1077' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Mar 16, 2018
2 parents e714294 + 56fcb7d commit de72db0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ include(FeatureSummary)

# Project declaration

project(Mapper VERSION 0.8.1 LANGUAGES CXX C)
project(Mapper VERSION 0.8.1.1 LANGUAGES CXX C)

if(Mapper_VERSION_DISPLAY)
message(STATUS "Custom version display string: \"${Mapper_VERSION_DISPLAY}\"")
Expand Down
19 changes: 9 additions & 10 deletions src/gui/main_window.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2012, 2013, 2014 Thomas Schöps
* Copyright 2012-2017 Kai Pastor
* Copyright 2012-2018 Kai Pastor
*
* This file is part of OpenOrienteering.
*
Expand Down Expand Up @@ -255,10 +255,11 @@ void MainWindow::setController(MainWindowController* new_controller, bool has_fi
createHelpMenu();

#if defined(Q_OS_MACOS)
// Disable all menu text heuristics, as a workaround for QTBUG-30812.
// Note that QAction::NoRole triggers QTBUG-29051,
// warnings in QCocoaMenuItem::sync() about menu items having
// "unsupported role QPlatformMenuItem::MenuRole(NoRole)".
// Defeat Qt's menu text heuristic, as a workaround for QTBUG-30812.
// Changing an action's menu role (to QAction::NoRole) after it was
// added to the menu is unsupported and triggers crashes (#1077).
// Instead, we defeat the heuristic by adding a zero width space at the
// beginning and the end of the text of every action in the menus.
const auto menubar_actions = menuBar()->actions();
for (auto action : menubar_actions)
{
Expand All @@ -267,15 +268,13 @@ void MainWindow::setController(MainWindowController* new_controller, bool has_fi
const auto menu_actions = menu->actions();
for (auto action : menu_actions)
{
if (action->menuRole() == QAction::TextHeuristicRole)
action->setMenuRole(QAction::NoRole);
static const auto zwsp = QString::fromUtf8("\u200B");
action->setText(zwsp + action->text() + zwsp);
}
}
}

// Probably related to QTBUG-62260.
// But even with Qt 5.9.3, the "Mapper" menu is not correct initially.
// (In Czech translation, the Settings menu is missing initially.)
// Needed to activate the menu bar changes
if (isVisible() && qApp->activeWindow() == this)
{
// Force a menu synchronisation,
Expand Down

0 comments on commit de72db0

Please sign in to comment.