summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2012-01-18 14:02:23 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-19 00:17:38 +0100
commit67a3698b3c558b5bd9fbd2e3b0121bab8c949c95 (patch)
tree342a16a65482860924322c1b68729a203d6a33b9
parentf4ea85f8fe35cb30aed73242bf93e869c3c74a0d (diff)
downloadqtbase-67a3698b3c558b5bd9fbd2e3b0121bab8c949c95.tar.gz
Remove all references to QAccessible::(Covers|Covered)
These were not used in any bridges, and none of the bridges (MSAA, Cocoa, AT-SPI/IA2) can hardly make use of this information. Change-Id: If3cad6b6c1928535dd932f46c9ec6883a4a19c76 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
-rw-r--r--src/gui/accessible/qaccessible.h5
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp93
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp107
3 files changed, 2 insertions, 203 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index bafd3a8a6b..89036281b8 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -307,11 +307,6 @@ public:
enum RelationFlag {
Unrelated = 0x00000000,
Self = 0x00000001,
-
- Covers = 0x00001000,
- Covered = 0x00002000,
- GeometryMask = 0x0000ff00,
-
FocusChild = 0x00010000,
Label = 0x00020000,
Labelled = 0x00040000,
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index ae09b011dd..f4b73b5d3c 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -361,34 +361,8 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
if (inverse & QAccessible::Label)
relation |= QAccessible::Labelled;
- if(o == object()) {
- return relation | QAccessible::Self;
- }
-
- QObject *parent = object()->parent();
- if (o->parent() == parent) {
- QAccessibleInterface *sibIface = QAccessible::queryAccessibleInterface(o);
- Q_ASSERT(sibIface);
- QRect wg = rect();
- QRect sg = sibIface->rect();
- if (wg.intersects(sg)) {
- QAccessibleInterface *pIface = 0;
- pIface = sibIface->parent();
- if (pIface && !(sibIface->state().invisible | state().invisible)) {
- int wi = pIface->indexOfChild(this);
- int si = pIface->indexOfChild(sibIface);
-
- if (wi > si)
- relation |= QAccessible::Covers;
- else
- relation |= QAccessible::Covered;
- }
- delete pIface;
- }
- delete sibIface;
-
- return relation;
- }
+ if(o == object())
+ relation |= QAccessible::Self;
return relation;
}
@@ -422,69 +396,6 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QObject *targetObject = 0;
switch (relation) {
- case QAccessible::Covers:
- if (entry > 0) {
- QAccessibleInterface *pIface = parent();
- if (!pIface)
- return -1;
-
- QRect r = rect();
- int sibCount = pIface->childCount();
- QAccessibleInterface *sibling = 0;
- // FIXME: this code looks very suspicious
- // why start at this index?
- for (int i = pIface->indexOfChild(this) + 2; i <= sibCount && entry; ++i) {
- sibling = pIface->child(i - 1);
- if (!sibling || (sibling->state().invisible)) {
- delete sibling;
- sibling = 0;
- continue;
- }
- if (sibling->rect().intersects(r))
- --entry;
- if (!entry)
- break;
- delete sibling;
- sibling = 0;
- }
- delete pIface;
- *target = sibling;
- if (*target)
- return 0;
- }
- break;
- case QAccessible::Covered:
- if (entry > 0) {
- QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
- if (!pIface)
- return -1;
-
- QRect r = rect();
- int index = pIface->indexOfChild(this);
- QAccessibleInterface *sibling = 0;
- // FIXME: why end at index?
- for (int i = 0; i < index && entry; ++i) {
- sibling = pIface->child(i);
- Q_ASSERT(sibling);
- if (!sibling || (sibling->state().invisible)) {
- delete sibling;
- sibling = 0;
- continue;
- }
- if (sibling->rect().intersects(r))
- --entry;
- if (!entry)
- break;
- delete sibling;
- sibling = 0;
- }
- delete pIface;
- *target = sibling;
- if (*target)
- return 0;
- }
- break;
-
// Logical
case QAccessible::FocusChild:
{
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 90ab5b4c67..62bc043080 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -233,7 +233,6 @@ private slots:
void statesStructTest();
void navigateHierarchy();
void sliderTest();
- void navigateCovered();
void textAttributes();
void hideShowTest();
@@ -515,112 +514,6 @@ void tst_QAccessibility::sliderTest()
QTestAccessibility::clearEvents();
}
-void tst_QAccessibility::navigateCovered()
-{
- {
- QWidget *w = new QWidget(0);
- w->setObjectName(QString("Harry"));
- QWidget *w1 = new QWidget(w);
- w1->setObjectName(QString("1"));
- QWidget *w2 = new QWidget(w);
- w2->setObjectName(QString("2"));
- w->show();
-#if defined(Q_OS_UNIX)
- QCoreApplication::processEvents();
- QTest::qWait(100);
-#endif
-
- w->setFixedSize(6, 6);
- w1->setFixedSize(5, 5);
- w2->setFixedSize(5, 5);
- w2->move(0, 0);
- w1->raise();
-
- QAccessibleInterface *iface1 = QAccessible::queryAccessibleInterface(w1);
- QVERIFY(iface1 != 0);
- QVERIFY(iface1->isValid());
- QAccessibleInterface *iface2 = QAccessible::queryAccessibleInterface(w2);
- QVERIFY(iface2 != 0);
- QVERIFY(iface2->isValid());
- QAccessibleInterface *iface3 = 0;
-
- QCOMPARE(iface1->navigate(QAccessible::Covers, -42, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface1->navigate(QAccessible::Covers, 0, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface1->navigate(QAccessible::Covers, 2, &iface3), -1);
- QVERIFY(iface3 == 0);
-
- for (int loop = 0; loop < 2; ++loop) {
- for (int x = 0; x < w->width(); ++x) {
- for (int y = 0; y < w->height(); ++y) {
- w1->move(x, y);
- if (w1->geometry().intersects(w2->geometry())) {
- QVERIFY(iface1->relationTo(iface2) & QAccessible::Covers);
- QVERIFY(iface2->relationTo(iface1) & QAccessible::Covered);
- QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), 0);
- QVERIFY(iface3 != 0);
- QVERIFY(iface3->isValid());
- QCOMPARE(iface3->object(), iface2->object());
- delete iface3; iface3 = 0;
- QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), 0);
- QVERIFY(iface3 != 0);
- QVERIFY(iface3->isValid());
- QCOMPARE(iface3->object(), iface1->object());
- delete iface3; iface3 = 0;
- } else {
- QVERIFY(!(iface1->relationTo(iface2) & QAccessible::Covers));
- QVERIFY(!(iface2->relationTo(iface1) & QAccessible::Covered));
- QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
- }
- }
- }
- if (!loop) {
- // switch children for second loop
- w2->raise();
- QAccessibleInterface *temp = iface1;
- iface1 = iface2;
- iface2 = temp;
- }
- }
- delete iface1; iface1 = 0;
- delete iface2; iface2 = 0;
- iface1 = QAccessible::queryAccessibleInterface(w1);
- QVERIFY(iface1 != 0);
- QVERIFY(iface1->isValid());
- iface2 = QAccessible::queryAccessibleInterface(w2);
- QVERIFY(iface2 != 0);
- QVERIFY(iface2->isValid());
-
- w1->move(0,0);
- w2->move(0,0);
- w1->raise();
- QVERIFY(iface1->relationTo(iface2) & QAccessible::Covers);
- QVERIFY(iface2->relationTo(iface1) & QAccessible::Covered);
- QVERIFY(!iface1->state().invisible);
- w1->hide();
- QVERIFY(iface1->state().invisible);
- QVERIFY(!(iface1->relationTo(iface2) & QAccessible::Covers));
- QVERIFY(!(iface2->relationTo(iface1) & QAccessible::Covered));
- QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
- QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1);
- QVERIFY(iface3 == 0);
-
- delete iface1; iface1 = 0;
- delete iface2; iface2 = 0;
- delete w;
- }
- QTestAccessibility::clearEvents();
-}
-
void tst_QAccessibility::navigateHierarchy()
{
{