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
Pick-to: 5.15
Change-Id: Ic9303e3df73ddd876fc78a0038f9379dbdf1853c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Zhang Yu 2020-10-19 09:43:27 +08:00
parent aee81c00cf
commit 407e171b40

View File

@ -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