summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsaccessibility.cpp
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-02-09 11:20:34 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-10 15:21:46 +0100
commitff2886db6a3308c1f4ee0879af497a5d43c33133 (patch)
tree50bfc43dbcb2bb34898e7723519abde2181d0347 /src/plugins/platforms/windows/qwindowsaccessibility.cpp
parent482d96a0c5d523ace63f56bda6851926b4469dd0 (diff)
Move all usages of Relation enum values to QAccessible::relations()
Next step is to remove navigate(), but that has to be done in qtdeclarative first. Change-Id: I01ea1386c092446be04cc19d0f70adf53f094adc Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsaccessibility.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsaccessibility.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
index 2c49d8614d..e36e255947 100644
--- a/src/plugins/platforms/windows/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/qwindowsaccessibility.cpp
@@ -988,6 +988,17 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accKeyboardShortcut(VARIANT va
return *pszKeyboardShortcut ? S_OK : S_FALSE;
}
+static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAccessible::RelationFlag flag)
+{
+ typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
+ QVector<RelationPair> rels = iface->relations(flag);
+
+ for (int i = 1; i < rels.count(); ++i)
+ delete rels.at(i).first;
+
+ return rels.value(0).first;
+}
+
// moz: [important]
HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* pszName)
{
@@ -1001,8 +1012,20 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accName(VARIANT varID, BSTR* p
if (!child)
return E_FAIL;
name = child->text(QAccessible::Name);
+ if (name.isEmpty()) {
+ if (QAccessibleInterface *labelInterface = relatedInterface(child.data(), QAccessible::Label)) {
+ name = labelInterface->text(QAccessible::Name);
+ delete labelInterface;
+ }
+ }
} else {
name = accessible->text(QAccessible::Name);
+ if (name.isEmpty()) {
+ if (QAccessibleInterface *labelInterface = relatedInterface(accessible, QAccessible::Label)) {
+ name = labelInterface->text(QAccessible::Name);
+ delete labelInterface;
+ }
+ }
}
if (name.size()) {
*pszName = QStringToBSTR(name);