Skip to content
Permalink
Browse files

workaround broken QFontDialog on macOS with Qt5 (Fixes #20426)

QFontDialog using the native dialog is broken in some versions of
Qt5 on macOS, see
  - https://bugreports.qt.io/browse/QTBUG-69878
  - https://successfulsoftware.net/2018/11/02/qt-is-broken-on-macos-right-now/

this breaks QgsFontButton in ModeQFont. When opening the dialog it will
not change the format after accepting.

normally our code wouldn't use the native dialog on macOS anyway,
but due to using an outdated preprocessor check it was exhibiting
the broken behavior.

this patch restores the usage of a non-native font dialog on macOS.

discussions:
- https://issues.qgis.org/issues/20426
- #8585
  • Loading branch information
iona5 authored and PeterPetrik committed Dec 4, 2018
1 parent a1dbb96 commit 930c56f5b85db0c452263225fb51f8bf9f2e003c
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/gui/qgsguiutils.cpp
@@ -195,9 +195,12 @@ namespace QgsGuiUtils
// parent is intentionally not set to 'this' as
// that would make it follow the style sheet font
// see also #12233 and #4937
#if defined(Q_OS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
return QFontDialog::getFont( &ok, initial, 0, title, QFontDialog::DontUseNativeDialog );
#if defined(Q_OS_MAC)
// Native dialog broken on macOS with Qt5
// probably only broken in Qt5.11.1 and .2
// (see https://successfulsoftware.net/2018/11/02/qt-is-broken-on-macos-right-now/ )
// possible upstream bug: https://bugreports.qt.io/browse/QTBUG-69878 (fixed in Qt 5.12 ?)
return QFontDialog::getFont( &ok, initial, nullptr, title, QFontDialog::DontUseNativeDialog );
#else
return QFontDialog::getFont( &ok, initial, nullptr, title );
#endif

0 comments on commit 930c56f

Please sign in to comment.
You can’t perform that action at this time.