diff options
Diffstat (limited to 'src/templates/qquicktextarea.cpp')
-rw-r--r-- | src/templates/qquicktextarea.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/templates/qquicktextarea.cpp b/src/templates/qquicktextarea.cpp index 05b1b9a7..85e1a9ec 100644 --- a/src/templates/qquicktextarea.cpp +++ b/src/templates/qquicktextarea.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE */ QQuickTextAreaPrivate::QQuickTextAreaPrivate() - : background(Q_NULLPTR), focusReason(Qt::OtherFocusReason), accessibleAttached(Q_NULLPTR) + : background(nullptr), focusReason(Qt::OtherFocusReason), accessibleAttached(nullptr) { #ifndef QT_NO_ACCESSIBILITY QAccessible::installActivationObserver(this); @@ -249,18 +249,19 @@ QQuickItem *QQuickTextArea::background() const void QQuickTextArea::setBackground(QQuickItem *background) { Q_D(QQuickTextArea); - if (d->background != background) { - delete d->background; - d->background = background; - if (background) { - background->setParentItem(this); - if (qFuzzyIsNull(background->z())) - background->setZ(-1); - if (isComponentComplete()) - d->resizeBackground(); - } - emit backgroundChanged(); + if (d->background == background) + return; + + delete d->background; + d->background = background; + if (background) { + background->setParentItem(this); + if (qFuzzyIsNull(background->z())) + background->setZ(-1); + if (isComponentComplete()) + d->resizeBackground(); } + emit backgroundChanged(); } /*! @@ -277,14 +278,15 @@ QString QQuickTextArea::placeholderText() const void QQuickTextArea::setPlaceholderText(const QString &text) { Q_D(QQuickTextArea); - if (d->placeholder != text) { - d->placeholder = text; + if (d->placeholder == text) + return; + + d->placeholder = text; #ifndef QT_NO_ACCESSIBILITY - if (d->accessibleAttached) - d->accessibleAttached->setDescription(text); + if (d->accessibleAttached) + d->accessibleAttached->setDescription(text); #endif - emit placeholderTextChanged(); - } + emit placeholderTextChanged(); } /*! @@ -315,10 +317,11 @@ Qt::FocusReason QQuickTextArea::focusReason() const void QQuickTextArea::setFocusReason(Qt::FocusReason reason) { Q_D(QQuickTextArea); - if (d->focusReason != reason) { - d->focusReason = reason; - emit focusReasonChanged(); - } + if (d->focusReason == reason) + return; + + d->focusReason = reason; + emit focusReasonChanged(); } void QQuickTextArea::classBegin() |