summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfontdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs/qfontdialog.cpp')
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 7e71cd7cd4..b267f67422 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -171,11 +171,6 @@ void QFontDialogPrivate::init()
{
Q_Q(QFontDialog);
-#ifdef Q_WS_MAC
- nativeDialogInUse = false;
- delegate = 0;
-#endif
-
q->setSizeGripEnabled(true);
q->setWindowTitle(QFontDialog::tr("Select Font"));
@@ -805,8 +800,10 @@ 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_sys(font);
+ if (d->canBeNativeDialog()) {
+ if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ helper->setCurrentFont_sys(font);
+ }
#ifdef Q_WS_MAC
if (d->delegate)
@@ -824,8 +821,10 @@ void QFontDialog::setCurrentFont(const QFont &font)
QFont QFontDialog::currentFont() const
{
Q_D(const QFontDialog);
- if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
- return helper->currentFont_sys();
+ if (d->canBeNativeDialog()) {
+ if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
+ return helper->currentFont_sys();
+ }
return d->sampleEdit->font();
}
@@ -1013,9 +1012,9 @@ void QFontDialog::done(int result)
d->memberToDisconnectOnClose.clear();
}
-bool QFontDialogPrivate::canBeNativeDialog()
+bool QFontDialogPrivate::canBeNativeDialog() const
{
- Q_Q(QFontDialog);
+ Q_Q(const QFontDialog);
if (nativeDialogInUse)
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))