From 8b24ed162cff3df7473345dedc14a412fabe8936 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 10 May 2012 21:36:24 +0200 Subject: [PATCH] Accessibility: Do not automatically add controllers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit While I do like the idea, it currently relies on every QWidget having QAccessibleWidget as a11y representation. This crashes for example when using the itemviews and asking them for relations. Change-Id: Ie15a78dae620eefb97c646b9e802b13bdf864650 Reviewed-by: Jan-Arve Sæther --- src/widgets/accessible/qaccessiblewidget.cpp | 19 ----------------- .../other/qaccessibility/tst_qaccessibility.cpp | 24 ---------------------- 2 files changed, 43 deletions(-) diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 17ba14d..bf3c187 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -377,25 +377,6 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel } } - if (match & QAccessible::Controller) { - const QAccessible::Relation rel = QAccessible::Controller; - QACConnectionObject *connectionObject = (QACConnectionObject*)object(); - const QObjectList senderList = connectionObject->senderList(); - for (int s = 0; s < senderList.count(); ++s) { - QObject *sender = senderList.at(s); - if (sender->isWidgetType() && sender != object()) { - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(sender); - QACConnectionObject *connectionSender = (QACConnectionObject*)sender; - QStringList senderPrimarySignals = static_cast(iface)->d->primarySignals; - for (int sig = 0; sig < senderPrimarySignals.count(); ++sig) { - const QByteArray strSignal = senderPrimarySignals.at(sig).toLatin1(); - if (connectionSender->isSender(object(), strSignal.constData())) - rels.append(qMakePair(iface, rel)); - } - } - } - } - if (match & QAccessible::Controlled) { QObjectList allReceivers; QACConnectionObject *connectionObject = (QACConnectionObject*)object(); diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 4607be4..2a40133 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -906,30 +906,6 @@ void tst_QAccessibility::buttonTest() toggletool.setText("Toggle"); toggletool.setMinimumSize(20,20); - // test Controller/Controlled relations - { - QCheckBox toggler("Toggle me!", &window); - bool ok = connect(&pushButton, SIGNAL(clicked()), &toggler, SLOT(toggle())); - QCOMPARE(ok, true); - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&toggler); - QVERIFY(iface); - QCOMPARE(iface->role(), QAccessible::CheckBox); - QAccessibleInterface *buttonIFace = relatedInterface(iface, QAccessible::Controller); - QVERIFY(buttonIFace); - QCOMPARE(buttonIFace->role(), QAccessible::Button); - QCOMPARE(buttonIFace->object(), &pushButton); - delete buttonIFace; - delete iface; - - buttonIFace = QAccessible::queryAccessibleInterface(&pushButton); - QVERIFY(buttonIFace); - QCOMPARE(buttonIFace->role(), QAccessible::Button); - iface = relatedInterface(buttonIFace, QAccessible::Controlled); - QVERIFY(iface); - QCOMPARE(iface->object(), &toggler); - - } - // test push button QAccessibleInterface* interface = QAccessible::queryAccessibleInterface(&pushButton); QAccessibleActionInterface* actionInterface = interface->actionInterface(); -- 2.7.4