+#if defined(Q_OS_MAC) && QT_VERSION > 0x050000
+ /// Additional check for Control and Meta modifier swap state.
+ /// Starting with Qt 5 the modifiers aren't reported correctly.
+ /// Until this is fixed a correction is required.
+ const bool dontSwapCtrlAndMeta =
+ frontend::theGuiApp()->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
+#else
+ const bool dontSwapCtrlAndMeta = false;
+#endif
+
+ if (state & (dontSwapCtrlAndMeta ? Qt::MetaModifier : Qt::ControlModifier))