aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/qquickcontrol.cpp')
-rw-r--r--src/templates/qquickcontrol.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp
index 9dbe4181..ae6180ad 100644
--- a/src/templates/qquickcontrol.cpp
+++ b/src/templates/qquickcontrol.cpp
@@ -201,10 +201,15 @@ void QQuickControl::accessibilityActiveChanged(bool active)
return;
d->accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
- if (d->accessibleAttached)
- d->accessibleAttached->setRole(accessibleRole());
- else
- qWarning() << "QQuickControl: " << this << " QQuickAccessibleAttached object creation failed!";
+
+ // QQuickControl relies on the existence of a QQuickAccessibleAttached object.
+ // However, qmlAttachedPropertiesObject(create=true) creates an instance only
+ // for items that have been created by a QML engine. Therefore we create the
+ // object by hand for items created in C++ (QQuickPopupItem, for instance).
+ if (!d->accessibleAttached)
+ d->accessibleAttached = new QQuickAccessibleAttached(this);
+
+ d->accessibleAttached->setRole(accessibleRole());
}
#endif