From d9e3281115b7c574dfb30c5094a8f9441bd60e35 Mon Sep 17 00:00:00 2001 From: Zhang Yu Date: Mon, 19 Oct 2020 09:43:27 +0800 Subject: Fix QFontDialog::selectedFont() does not return actual selected font "QFontDialog::accepted" was emitted before setting "selectedFont" to current font. So when calling "QFontDialog::selectedFont()" in slot of signal "QFontDialog::accepted",it does not return actual selected font. Fixes: QTBUG-87483 Change-Id: Ic9303e3df73ddd876fc78a0038f9379dbdf1853c Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 407e171b40c3be3036ef71227d43c49f0b8d5788) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/dialogs/qfontdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index fe8f88d64f..8e42804943 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -1006,7 +1006,6 @@ void QFontDialog::setVisible(bool visible) void QFontDialog::done(int result) { Q_D(QFontDialog); - QDialog::done(result); if (result == Accepted) { // We check if this is the same font we had before, if so we emit currentFontChanged QFont selectedFont = currentFont(); @@ -1022,6 +1021,7 @@ void QFontDialog::done(int result) d->receiverToDisconnectOnClose = nullptr; } d->memberToDisconnectOnClose.clear(); + QDialog::done(result); } bool QFontDialogPrivate::canBeNativeDialog() const -- cgit v1.2.3