Skip to content

Commit

Permalink
workaround broken QFontDialog on macOS with Qt5 (Fixes #20426)
Browse files Browse the repository at this point in the history
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 930c56f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/gui/qgsguiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 930c56f

Please sign in to comment.