summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qfontdialog.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-11-23 12:04:01 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-14 21:49:33 +0100
commit56c4ddfdf62ff6b71ce3df680bdaca01012e13f4 (patch)
tree5777f621303392efa9852f982e52a09a9e44e7e0 /src/widgets/dialogs/qfontdialog.cpp
parentf86007175d7d9d592e9cf6499704ad4f17944ce4 (diff)
QPlatformDialogHelpers: Reduce dependency on QDialog.
For each QDialog-derived class, introduce a Q[X]Options class containing the options of the dialog. An instance is shared between the QDialog (or dialog desktop component) and the helper. Change-Id: Ibabf508a4b9eaea25615638a47a4c1b8f93c019e Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/widgets/dialogs/qfontdialog.cpp')
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 1935a5aa73..3cc33dad9b 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -495,6 +495,12 @@ 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);
+}
+
+void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
+{
+ options->setWindowTitle(q_func()->windowTitle());
}
/*
@@ -888,8 +894,7 @@ QFont QFontDialog::selectedFont() const
void QFontDialog::setOption(FontDialogOption option, bool on)
{
Q_D(QFontDialog);
- if (!(d->opts & option) != !on)
- setOptions(d->opts ^ option);
+ d->options->setOption(static_cast<QFontDialogOptions::FontDialogOption>(option), on);
}
/*!
@@ -901,7 +906,7 @@ void QFontDialog::setOption(FontDialogOption option, bool on)
bool QFontDialog::testOption(FontDialogOption option) const
{
Q_D(const QFontDialog);
- return (d->opts & option) != 0;
+ return d->options->testOption(static_cast<QFontDialogOptions::FontDialogOption>(option));
}
/*!
@@ -921,18 +926,17 @@ void QFontDialog::setOptions(FontDialogOptions options)
{
Q_D(QFontDialog);
- FontDialogOptions changed = (options ^ d->opts);
- if (!changed)
+ if (QFontDialog::options() == options)
return;
- d->opts = options;
+ d->options->setOptions(QFontDialogOptions::FontDialogOptions(int(options)));
d->buttonBox->setVisible(!(options & NoButtons));
}
QFontDialog::FontDialogOptions QFontDialog::options() const
{
Q_D(const QFontDialog);
- return d->opts;
+ return QFontDialog::FontDialogOptions(int(d->options->options()));
}
#ifdef Q_WS_MAC
@@ -1043,7 +1047,7 @@ bool QFontDialogPrivate::canBeNativeDialog()
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
return false;
- if (opts & QFontDialog::DontUseNativeDialog)
+ if (options->options() & QFontDialog::DontUseNativeDialog)
return false;
QLatin1String staticName(QFontDialog::staticMetaObject.className());