From 54c800e467dde552270ad68a0965a94f9d00cee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Wed, 30 Oct 2019 16:04:22 +0100 Subject: [PATCH] workaround for QFontDialog issue locking current font (https://bugreports.qt.io/browse/QTBUG-79637) --- src/domain/UBGraphicsTextItemDelegate.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index 71371df4..9691fa07 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -280,8 +280,6 @@ void UBGraphicsTextItemDelegate::contentsChanged() // will remain in the font list. void UBGraphicsTextItemDelegate::customize(QFontDialog &fontDialog) { - fontDialog.setOption(QFontDialog::DontUseNativeDialog); - if (UBSettings::settings()->isDarkBackground()) { fontDialog.setStyleSheet("background-color: white;"); } @@ -334,7 +332,11 @@ void UBGraphicsTextItemDelegate::pickFont() { if (mDelegated && mDelegated->scene() && mDelegated->scene()->views().size() > 0) { - QFontDialog fontDialog(delegated()->textCursor().charFormat().font(), static_cast(UBApplication::boardController->controlView())); + // https://bugreports.qt.io/browse/QTBUG-79637 + QFontDialog fontDialog(static_cast(UBApplication::boardController->controlView())); + + fontDialog.setOption(QFontDialog::DontUseNativeDialog); + fontDialog.setCurrentFont(delegated()->textCursor().charFormat().font()); customize(fontDialog); if (fontDialog.exec())