aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicklabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquicklabel.cpp')
-rw-r--r--src/quicktemplates2/qquicklabel.cpp48
1 files changed, 14 insertions, 34 deletions
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index df710733..45c7e5a4 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -41,9 +41,8 @@
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickclipnode_p.h>
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
#include <QtQuick/private/qquickaccessibleattached_p.h>
#endif
@@ -79,29 +78,18 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Label}
*/
-QQuickLabel::QQuickLabel(QQuickItem *parent) :
- QQuickText(*(new QQuickLabelPrivate), parent)
-{
- Q_D(QQuickLabel);
- QObjectPrivate::connect(this, &QQuickText::textChanged,
- d, &QQuickLabelPrivate::_q_textChanged);
-}
-
-QQuickLabel::~QQuickLabel()
-{
-}
-
QQuickLabelPrivate::QQuickLabelPrivate()
- : background(nullptr), accessibleAttached(nullptr)
+ : background(nullptr),
+ accessibleAttached(nullptr)
{
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::installActivationObserver(this);
#endif
}
QQuickLabelPrivate::~QQuickLabelPrivate()
{
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
QAccessible::removeActivationObserver(this);
#endif
}
@@ -135,9 +123,9 @@ void QQuickLabelPrivate::inheritFont(const QFont &f)
emit q->fontChanged();
}
-void QQuickLabelPrivate::_q_textChanged(const QString &text)
+void QQuickLabelPrivate::textChanged(const QString &text)
{
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (accessibleAttached)
accessibleAttached->setName(text);
#else
@@ -145,7 +133,7 @@ void QQuickLabelPrivate::_q_textChanged(const QString &text)
#endif
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
{
if (accessibleAttached || !active)
@@ -167,16 +155,11 @@ QAccessible::Role QQuickLabelPrivate::accessibleRole() const
}
#endif
-/*
- Deletes "delegate" if Component.completed() has been emitted,
- otherwise stores it in pendingDeletions.
-*/
-void QQuickLabelPrivate::deleteDelegate(QObject *delegate)
+QQuickLabel::QQuickLabel(QQuickItem *parent)
+ : QQuickText(*(new QQuickLabelPrivate), parent)
{
- if (componentComplete)
- delete delegate;
- else if (delegate)
- pendingDeletions.append(delegate);
+ Q_D(QQuickLabel);
+ QObjectPrivate::connect(this, &QQuickText::textChanged, d, &QQuickLabelPrivate::textChanged);
}
QFont QQuickLabel::font() const
@@ -217,7 +200,7 @@ void QQuickLabel::setBackground(QQuickItem *background)
if (d->background == background)
return;
- d->deleteDelegate(d->background);
+ QQuickControlPrivate::destroyDelegate(d->background, this);
d->background = background;
if (background) {
background->setParentItem(this);
@@ -238,13 +221,10 @@ void QQuickLabel::componentComplete()
{
Q_D(QQuickLabel);
QQuickText::componentComplete();
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (!d->accessibleAttached && QAccessible::isActive())
d->accessibilityActiveChanged(true);
#endif
-
- qDeleteAll(d->pendingDeletions);
- d->pendingDeletions.clear();
}
void QQuickLabel::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)