Skip to content
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

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.

- #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 )
// possible upstream bug: (fixed in Qt 5.12 ?)
return QFontDialog::getFont( &ok, initial, nullptr, title, QFontDialog::DontUseNativeDialog );
return QFontDialog::getFont( &ok, initial, nullptr, title );

0 comments on commit 930c56f

Please sign in to comment.