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>
bb10
J-P Nurmi 2016-08-13 17:29:05 +02:00
parent 0295984786
commit b57c878dfc
2 changed files with 8 additions and 1 deletions

View File

@ -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();

View File

@ -136,6 +136,7 @@ private Q_SLOTS:
void onAccepted();
private:
static void onFontChanged(QGtk3FontDialogHelper *helper);
void applyOptions();
QScopedPointer<QGtk3Dialog> d;