diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/templates/qquickapplicationwindow.cpp | 6 | ||||
-rw-r--r-- | src/templates/qquickcontrol.cpp | 6 | ||||
-rw-r--r-- | src/templates/qquicklabel.cpp | 12 | ||||
-rw-r--r-- | src/templates/qquicktextarea.cpp | 12 | ||||
-rw-r--r-- | src/templates/qquicktextfield.cpp | 12 |
5 files changed, 35 insertions, 13 deletions
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp index 9a9e5460..309c8d3a 100644 --- a/src/templates/qquickapplicationwindow.cpp +++ b/src/templates/qquickapplicationwindow.cpp @@ -396,7 +396,7 @@ QFont QQuickApplicationWindow::font() const void QQuickApplicationWindow::setFont(const QFont &f) { Q_D(QQuickApplicationWindow); - if (d->font == f) + if (d->font.resolve() == f.resolve() && d->font == f) return; QFont resolvedFont = f.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont)); @@ -417,11 +417,13 @@ void QQuickApplicationWindowPrivate::resolveFont() void QQuickApplicationWindowPrivate::updateFont(const QFont &f) { Q_Q(QQuickApplicationWindow); + const bool changed = font != f; font = f; QQuickControlPrivate::updateFontRecur(q->contentItem(), f); - emit q->fontChanged(); + if (changed) + emit q->fontChanged(); } QLocale QQuickApplicationWindow::locale() const diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp index 0e14bc37..78ecaa91 100644 --- a/src/templates/qquickcontrol.cpp +++ b/src/templates/qquickcontrol.cpp @@ -287,11 +287,13 @@ void QQuickControlPrivate::resolveFont() void QQuickControlPrivate::updateFont(const QFont &f) { Q_Q(QQuickControl); + const bool changed = font != f; font = f; QQuickControlPrivate::updateFontRecur(q, f); - emit q->fontChanged(); + if (changed) + emit q->fontChanged(); } void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f) @@ -411,7 +413,7 @@ QFont QQuickControl::font() const void QQuickControl::setFont(const QFont &f) { Q_D(QQuickControl); - if (d->font == f) + if (d->font.resolve() == f.resolve() && d->font == f) return; // Determine which font is inherited from this control's ancestors and diff --git a/src/templates/qquicklabel.cpp b/src/templates/qquicklabel.cpp index 13ff3a6e..7de520d9 100644 --- a/src/templates/qquicklabel.cpp +++ b/src/templates/qquicklabel.cpp @@ -113,9 +113,12 @@ void QQuickLabelPrivate::resolveFont() if (sourceFont.resolve() == resolvedFont.resolve() && sourceFont == resolvedFont) return; + const bool changed = sourceFont != resolvedFont; + q->QQuickText::setFont(resolvedFont); - emit q->fontChanged(); + if (changed) + emit q->fontChanged(); } void QQuickLabelPrivate::_q_textChanged(const QString &text) @@ -158,7 +161,7 @@ QFont QQuickLabel::font() const void QQuickLabel::setFont(const QFont &font) { Q_D(QQuickLabel); - if (d->sourceFont == font) + if (d->sourceFont.resolve() == font.resolve() && d->sourceFont == font) return; // Determine which font is inherited from this control's ancestors and @@ -170,9 +173,12 @@ void QQuickLabel::setFont(const QFont &font) if (d->sourceFont.resolve() == resolvedFont.resolve() && d->sourceFont == resolvedFont) return; + const bool changed = d->sourceFont != resolvedFont; + QQuickText::setFont(font); - emit fontChanged(); + if (changed) + emit fontChanged(); } /*! diff --git a/src/templates/qquicktextarea.cpp b/src/templates/qquicktextarea.cpp index 05b1b9a7..97eff350 100644 --- a/src/templates/qquicktextarea.cpp +++ b/src/templates/qquicktextarea.cpp @@ -166,9 +166,12 @@ void QQuickTextAreaPrivate::resolveFont() if (sourceFont.resolve() == resolvedFont.resolve() && sourceFont == resolvedFont) return; + const bool changed = sourceFont != resolvedFont; + q->QQuickTextEdit::setFont(resolvedFont); - emit q->fontChanged(); + if (changed) + emit q->fontChanged(); } void QQuickTextAreaPrivate::_q_readOnlyChanged(bool isReadOnly) @@ -212,7 +215,7 @@ QFont QQuickTextArea::font() const void QQuickTextArea::setFont(const QFont &font) { Q_D(QQuickTextArea); - if (d->sourceFont == font) + if (d->sourceFont.resolve() == font.resolve() && d->sourceFont == font) return; // Determine which font is inherited from this control's ancestors and @@ -224,9 +227,12 @@ void QQuickTextArea::setFont(const QFont &font) if (d->sourceFont.resolve() == resolvedFont.resolve() && d->sourceFont == resolvedFont) return; + const bool changed = d->sourceFont != resolvedFont; + QQuickTextEdit::setFont(font); - emit fontChanged(); + if (changed) + emit fontChanged(); } /*! diff --git a/src/templates/qquicktextfield.cpp b/src/templates/qquicktextfield.cpp index c3070614..06a2f8e0 100644 --- a/src/templates/qquicktextfield.cpp +++ b/src/templates/qquicktextfield.cpp @@ -180,9 +180,12 @@ void QQuickTextFieldPrivate::resolveFont() if (sourceFont.resolve() == resolvedFont.resolve() && sourceFont == resolvedFont) return; + const bool changed = sourceFont != resolvedFont; + q->QQuickTextInput::setFont(resolvedFont); - emit q->fontChanged(); + if (changed) + emit q->fontChanged(); } void QQuickTextFieldPrivate::_q_readOnlyChanged(bool isReadOnly) @@ -237,7 +240,7 @@ QFont QQuickTextField::font() const void QQuickTextField::setFont(const QFont &font) { Q_D(QQuickTextField); - if (d->sourceFont == font) + if (d->sourceFont.resolve() == font.resolve() && d->sourceFont == font) return; // Determine which font is inherited from this control's ancestors and @@ -249,9 +252,12 @@ void QQuickTextField::setFont(const QFont &font) if (d->sourceFont.resolve() == resolvedFont.resolve() && d->sourceFont == resolvedFont) return; + const bool changed = d->sourceFont != resolvedFont; + QQuickTextInput::setFont(font); - emit fontChanged(); + if (changed) + emit fontChanged(); } /*! |