diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-04-16 15:26:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-18 19:55:35 +0200 |
commit | a7fd8696dd303ab09328a916aa2a98e4d88db38d (patch) | |
tree | 4c24463c5fd7bd44f103195a63357caae43d84fb /util | |
parent | cbde509965a30bbcfb7930b84f22bdb7835c104e (diff) | |
download | qtbase-a7fd8696dd303ab09328a916aa2a98e4d88db38d.tar.gz |
Hide "invalid" accessibility interfaces.
Those with a null object pointer and those with a
null rect.
Change-Id: I40e0c435ee768fc8c58098fec131eb65e89d76f2
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/accessibilityinspector/accessibilityscenemanager.cpp | 16 | ||||
-rw-r--r-- | util/accessibilityinspector/optionswidget.h | 16 | ||||
-rw-r--r-- | util/accessibilityinspector/screenreader.cpp | 3 |
3 files changed, 32 insertions, 3 deletions
diff --git a/util/accessibilityinspector/accessibilityscenemanager.cpp b/util/accessibilityinspector/accessibilityscenemanager.cpp index 80bc3f4ba8..6ecf30c163 100644 --- a/util/accessibilityinspector/accessibilityscenemanager.cpp +++ b/util/accessibilityinspector/accessibilityscenemanager.cpp @@ -253,9 +253,21 @@ void AccessibilitySceneManager::updateItemFlags(QGraphicsRectItem *item, QAccess } } + if (m_optionsWidget->hideNullObjectItems()) { + if (interface->object() == 0) { + shouldShow = false; + } + } + + if (m_optionsWidget->hideNullRectItems()) { + if (interface->rect().isNull()) { + shouldShow = false; + } + } + item->setVisible(shouldShow); - if (interface->object() == m_selectedObject) + if (interface->object() && interface->object() == m_selectedObject) item->setBrush(QColor(Qt::yellow)); else item->setBrush(QColor(Qt::white)); @@ -392,7 +404,7 @@ void AccessibilitySceneManager::addGraphicsItems(AccessibilitySceneManager::Tree graphicsItem->setRect(0, 0, m_treeItemWidth, m_treeItemHeight); graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - if (item.object == m_selectedObject) + if (item.object && item.object == m_selectedObject) graphicsItem->setBrush(QColor(Qt::yellow)); else graphicsItem->setBrush(QColor(Qt::white)); diff --git a/util/accessibilityinspector/optionswidget.h b/util/accessibilityinspector/optionswidget.h index 95c7fdf44a..9283122af7 100644 --- a/util/accessibilityinspector/optionswidget.h +++ b/util/accessibilityinspector/optionswidget.h @@ -77,6 +77,18 @@ public: m_hidePaneItems->setChecked(true); connect(m_hidePaneItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + m_hideNullObjectItems = new QCheckBox(this); + m_layout->addWidget(m_hideNullObjectItems); + m_hideNullObjectItems->setText("Hide Items with a null QObject pointer"); + m_hideNullObjectItems->setChecked(true); + connect(m_hideNullObjectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + + m_hideNullRectItems = new QCheckBox(this); + m_layout->addWidget(m_hideNullRectItems); + m_hideNullRectItems->setText("Hide Items with a null rect"); + m_hideNullRectItems->setChecked(true); + connect(m_hideNullRectItems, SIGNAL(toggled(bool)), SIGNAL(optionsChanged())); + m_enableTextToSpeach = new QCheckBox(this); m_layout->addWidget(m_enableTextToSpeach); m_enableTextToSpeach->setText("Enable Text To Speech"); @@ -96,6 +108,8 @@ public: bool hideInvisibleItems() { return m_hideInvisibleItems->isChecked(); } bool hideOffscreenItems() { return m_hideOffscreenItems->isChecked(); } bool hidePaneItems() { return m_hidePaneItems->isChecked(); } + bool hideNullObjectItems() { return m_hideNullObjectItems->isChecked(); } + bool hideNullRectItems() { return m_hideNullRectItems->isChecked(); } bool enableTextToSpeach() { return m_enableTextToSpeach->isChecked(); } signals: void optionsChanged(); @@ -109,6 +123,8 @@ private: QCheckBox *m_hideInvisibleItems; QCheckBox *m_hideOffscreenItems; QCheckBox *m_hidePaneItems; + QCheckBox *m_hideNullObjectItems; + QCheckBox *m_hideNullRectItems; QCheckBox *m_enableTextToSpeach; QSlider *m_scale; }; diff --git a/util/accessibilityinspector/screenreader.cpp b/util/accessibilityinspector/screenreader.cpp index 8b627b1454..262c8db986 100644 --- a/util/accessibilityinspector/screenreader.cpp +++ b/util/accessibilityinspector/screenreader.cpp @@ -107,7 +107,8 @@ void ScreenReader::processTouchPoint() } m_selectedInterface = currentInterface; - emit selected(m_selectedInterface->object()); + if (m_selectedInterface->object()) + emit selected(m_selectedInterface->object()); if (m_optionsWidget->enableTextToSpeach()) speak(m_selectedInterface->text(QAccessible::Name) /*+ "," + translateRole(m_selectedInterface->role(0)) */); |