QAccessibleDisplay: don't use a container for just one element

Drop the use of QVLA, and the loop. Put all of the code into
QT_NO_SHORTCUT.

Change-Id: I49b8e9aa403ea793fd2f3701a521776c33b64a3c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2016-08-25 12:05:58 +02:00
parent 75211131aa
commit f32dfc9125

View File

@ -462,21 +462,15 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >
QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const
{
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels = QAccessibleWidget::relations(match);
if (match & QAccessible::Labelled) {
QVarLengthArray<QObject *, 4> relatedObjects;
#ifndef QT_NO_SHORTCUT
if (match & QAccessible::Labelled) {
if (QLabel *label = qobject_cast<QLabel*>(object())) {
relatedObjects.append(label->buddy());
}
#endif
for (int i = 0; i < relatedObjects.count(); ++i) {
const QAccessible::Relation rel = QAccessible::Labelled;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(relatedObjects.at(i));
if (iface)
if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(label->buddy()))
rels.append(qMakePair(iface, rel));
}
}
#endif
return rels;
}