Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:krop:Qt6:Release
qt6-declarative
0001-QQuickAccessibleAttached-Let-implicit-name...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-QQuickAccessibleAttached-Let-implicit-names-work-whe.patch of Package qt6-declarative
From 71a9938f4e093c77fc7b9f1cf8043e6d3552aff3 Mon Sep 17 00:00:00 2001 From: Aleix Pol <aleixpol@kde.org> Date: Tue, 22 Oct 2024 02:47:48 +0200 Subject: [PATCH] QQuickAccessibleAttached: Let implicit names work when there's a proxy QQuickAccessibleAttached has infrastructure to provide an implicit name that we were bypassing now that we have proxies (introduced in 6.8). We should only use the name of the proxy when it's being set, otherwise we better provide the implicit name. Amends 7bdeea2c309150c8b49558b135232926d6a89c50. Fixes: QTBUG-130360 Pick-to: 6.8 Change-Id: I37470e1f28e837bdbb304726ee85f45ba6577621 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> --- src/quick/items/qquickaccessibleattached_p.h | 2 +- .../data/actionAccessibility/button2.qml | 9 +++++ .../accessibility/tst_accessibility.cpp | 36 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h index aa15b43..2d44000 100644 --- a/src/quick/items/qquickaccessibleattached_p.h +++ b/src/quick/items/qquickaccessibleattached_p.h @@ -87,7 +87,7 @@ public: QString name() const { if (m_state.passwordEdit) return QString(); - if (m_proxying) + if (!m_nameExplicitlySet && m_proxying && m_proxying->wasNameExplicitlySet()) return m_proxying->name(); return m_name; } diff --git a/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml b/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml new file mode 100644 index 0000000..1cd1c81 --- /dev/null +++ b/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml @@ -0,0 +1,9 @@ +import QtQuick +import QtQuick.Controls + +Button { + action: Action { + text: "Pears" + Accessible.description: "Show pears some love" + } +} diff --git a/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp b/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp index 8bdd945..2018c0e 100644 --- a/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp +++ b/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp @@ -33,6 +33,8 @@ private slots: void ordering(); void actionAccessibility(); + void actionAccessibilityImplicitName(); + private: QQmlEngine engine; }; @@ -279,6 +281,13 @@ void tst_accessibility::ordering() void tst_accessibility::actionAccessibility() { #if QT_CONFIG(accessibility) + if (!QAccessible::isActive()) { + QPlatformAccessibility *accessibility = platformAccessibility(); + if (!accessibility) + QSKIP("No QPlatformAccessibility available."); + accessibility->setActive(true); + } + QQmlComponent component(&engine); component.loadUrl(testFileUrl("actionAccessibility/button.qml")); @@ -296,6 +305,33 @@ void tst_accessibility::actionAccessibility() #endif } +void tst_accessibility::actionAccessibilityImplicitName() +{ +#if QT_CONFIG(accessibility) + if (!QAccessible::isActive()) { + QPlatformAccessibility *accessibility = platformAccessibility(); + if (!accessibility) + QSKIP("No QPlatformAccessibility available."); + accessibility->setActive(true); + } + + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("actionAccessibility/button2.qml")); + + QScopedPointer<QObject> object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); + + QQuickItem *item = qobject_cast<QQuickItem *>(object.data()); + QVERIFY(item); + const QString description = "Show pears some love"; + QCOMPARE(item->property("text"), "Pears"); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(item); + QVERIFY(iface); + QCOMPARE(iface->text(QAccessible::Name), "Pears"); // We get the action.text implicitly + QCOMPARE(iface->text(QAccessible::Description), description); +#endif +} + QTEST_MAIN(tst_accessibility) #include "tst_accessibility.moc" -- 2.47.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor