diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-13 17:29:05 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-17 15:45:57 +0000 |
commit | b57c878dfc9565e86854779ac2ccb38e5adad32b (patch) | |
tree | 33938e8bb59183553b7e28c3cd8b81161b5b77b9 | |
parent | 0295984786027eed9ac433592794300e7b2546f8 (diff) |
QGtk3FontDialogHelper: provide proper currentFontChanged()
A workaround for the missing currentFontChanged() signal was added in
130f43c. Now we can remove the improper emission on accept, because by
using the "notify::font" signal gives proper notifications whenever the
current font selection in the dialog changes.
Task-number: QTBUG-55298
Change-Id: Id9a4f32a92f0be8f466a0a0587bb2acd4c9056f7
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp index ced5fe7086..75549d47c1 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp @@ -483,6 +483,8 @@ QGtk3FontDialogHelper::QGtk3FontDialogHelper() d.reset(new QGtk3Dialog(gtk_font_chooser_dialog_new("", 0))); connect(d.data(), SIGNAL(accept()), this, SLOT(onAccepted())); connect(d.data(), SIGNAL(reject()), this, SIGNAL(reject())); + + g_signal_connect_swapped(d->gtkDialog(), "notify::font", G_CALLBACK(onFontChanged), this); } QGtk3FontDialogHelper::~QGtk3FontDialogHelper() @@ -588,11 +590,15 @@ QFont QGtk3FontDialogHelper::currentFont() const void QGtk3FontDialogHelper::onAccepted() { - emit currentFontChanged(currentFont()); emit accept(); emit fontSelected(currentFont()); } +void QGtk3FontDialogHelper::onFontChanged(QGtk3FontDialogHelper *dialog) +{ + emit dialog->currentFontChanged(dialog->currentFont()); +} + void QGtk3FontDialogHelper::applyOptions() { GtkDialog *gtkDialog = d->gtkDialog(); diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h index c852fd05f6..40961d5201 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h +++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h @@ -136,6 +136,7 @@ private Q_SLOTS: void onAccepted(); private: + static void onFontChanged(QGtk3FontDialogHelper *helper); void applyOptions(); QScopedPointer<QGtk3Dialog> d; |