diff options
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r-- | src/widgets/dialogs/qfontdialog.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index bec99b4df7..26e9212a95 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -426,10 +426,12 @@ bool QFontDialog::eventFilter(QObject *o , QEvent *e) void QFontDialogPrivate::initHelper(QPlatformDialogHelper *h) { - QFontDialog *d = q_func(); - QObject::connect(h, SIGNAL(currentFontChanged(QFont)), d, SIGNAL(currentFontChanged(QFont))); - QObject::connect(h, SIGNAL(fontSelected(QFont)), d, SIGNAL(fontSelected(QFont))); - static_cast<QPlatformFontDialogHelper *>(h)->setOptions(options); + Q_Q(QFontDialog); + auto *fontDialogHelper = static_cast<QPlatformFontDialogHelper *>(h); + fontDialogHelper->setOptions(options); + fontDialogHelper->setCurrentFont(q->currentFont()); + QObject::connect(h, SIGNAL(currentFontChanged(QFont)), q, SIGNAL(currentFontChanged(QFont))); + QObject::connect(h, SIGNAL(fontSelected(QFont)), q, SIGNAL(fontSelected(QFont))); } void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *) @@ -788,8 +790,11 @@ void QFontDialog::setCurrentFont(const QFont &font) d->strikeout->setChecked(font.strikeOut()); d->underline->setChecked(font.underline()); d->updateFamilies(); - if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper()) - helper->setCurrentFont(font); + + if (d->nativeDialogInUse) { + if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper()) + helper->setCurrentFont(font); + } } /*! @@ -802,8 +807,11 @@ void QFontDialog::setCurrentFont(const QFont &font) QFont QFontDialog::currentFont() const { Q_D(const QFontDialog); - if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper()) - return helper->currentFont(); + + if (d->nativeDialogInUse) { + if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper()) + return helper->currentFont(); + } return d->sampleEdit->font(); } |