2011-10-11 09:04:59 +00:00
|
|
|
/****************************************************************************
|
2012-01-24 07:03:14 +00:00
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-01-24 07:03:14 +00:00
|
|
|
**
|
|
|
|
** This file is part of the tools applications of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 12:36:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-01-24 07:03:14 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
2011-10-11 09:04:59 +00:00
|
|
|
|
|
|
|
#include "accessibilityscenemanager.h"
|
|
|
|
|
|
|
|
AccessibilitySceneManager::AccessibilitySceneManager()
|
|
|
|
{
|
|
|
|
m_window = 0;
|
|
|
|
m_view = 0;
|
|
|
|
m_scene = 0;
|
|
|
|
m_rootItem = 0;
|
|
|
|
m_optionsWidget = 0;
|
|
|
|
m_selectedObject = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::populateAccessibilityScene()
|
|
|
|
{
|
|
|
|
m_scene->clear();
|
|
|
|
m_graphicsItems.clear();
|
|
|
|
|
|
|
|
QAccessibleInterface * rootInterface = m_window->accessibleRoot();
|
|
|
|
if (!rootInterface)
|
|
|
|
return;
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
populateAccessibilityScene(rootInterface, m_scene);
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::updateAccessibilitySceneItemFlags()
|
|
|
|
{
|
|
|
|
qDebug() << "update";
|
|
|
|
foreach (QObject *object, m_graphicsItems.keys()) {
|
|
|
|
if (!object)
|
|
|
|
continue;
|
|
|
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(object);
|
|
|
|
if (!interface)
|
|
|
|
continue;
|
|
|
|
updateItemFlags(m_graphicsItems.value(object), interface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::populateAccessibilityTreeScene()
|
|
|
|
{
|
|
|
|
m_treeScene->clear();
|
|
|
|
QAccessibleInterface * rootInterface = m_window->accessibleRoot();
|
2011-12-01 18:50:15 +00:00
|
|
|
if (!rootInterface) {
|
|
|
|
qWarning("QWindow::accessibleRoot returned 0");
|
2011-10-11 09:04:59 +00:00
|
|
|
return;
|
2011-12-01 18:50:15 +00:00
|
|
|
}
|
2011-10-11 09:04:59 +00:00
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
populateAccessibilityTreeScene(rootInterface);
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
|
2013-04-16 11:34:18 +00:00
|
|
|
void AccessibilitySceneManager::handleUpdate(QAccessibleEvent *event)
|
2011-10-11 09:04:59 +00:00
|
|
|
{
|
2013-04-16 11:34:18 +00:00
|
|
|
QObject *object = event->object();
|
|
|
|
QAccessible::Event type = event->type();
|
|
|
|
|
2011-10-11 09:04:59 +00:00
|
|
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(object);
|
|
|
|
if (!interface)
|
|
|
|
return;
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
QString name = interface->text(QAccessible::Name);
|
2011-10-11 09:04:59 +00:00
|
|
|
|
2013-04-16 11:34:18 +00:00
|
|
|
if (type == QAccessible::ObjectCreated) {
|
2011-10-11 09:04:59 +00:00
|
|
|
// qDebug() << "ObjectCreated" << object << name;
|
2011-12-01 18:50:15 +00:00
|
|
|
populateAccessibilityScene(interface, m_scene);
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QGraphicsRectItem *item = m_graphicsItems.value(object);
|
|
|
|
|
|
|
|
if (!item) {
|
|
|
|
// qDebug() << "populateAccessibilityScene failed for" << object;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-16 11:34:18 +00:00
|
|
|
if (type == QAccessible::LocationChanged) {
|
2011-10-11 09:04:59 +00:00
|
|
|
|
|
|
|
//if (name.startsWith("List"))
|
2011-12-01 18:50:15 +00:00
|
|
|
qDebug() << "locationChange" << object << name << interface->rect();
|
2011-10-11 09:04:59 +00:00
|
|
|
|
|
|
|
updateItem(item, interface);
|
|
|
|
for (int i = 0; i < interface->childCount(); ++i) {
|
2012-01-17 19:02:18 +00:00
|
|
|
QAccessibleInterface *child = interface->child(i);
|
|
|
|
if (child) {
|
2011-10-11 09:04:59 +00:00
|
|
|
updateItem(m_graphicsItems.value(child->object()), child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-16 11:34:18 +00:00
|
|
|
} else if (type == QAccessible::ObjectDestroyed) {
|
2011-10-11 09:04:59 +00:00
|
|
|
// qDebug() << "ObjectDestroyed" << object << name;
|
|
|
|
delete m_graphicsItems.value(object);
|
|
|
|
m_graphicsItems.remove(object);
|
|
|
|
m_animatedObjects.remove(object);
|
|
|
|
if (object == m_selectedObject) {
|
|
|
|
m_selectedObject = 0;
|
|
|
|
}
|
2013-04-16 11:34:18 +00:00
|
|
|
} else if (type == QAccessible::ObjectHide) {
|
2011-10-11 09:04:59 +00:00
|
|
|
// qDebug() << "ObjectCreated Hide" << object;
|
|
|
|
updateItemFlags(item, interface);
|
2013-04-16 11:34:18 +00:00
|
|
|
} else if (type == QAccessible::ObjectShow) {
|
2011-10-11 09:04:59 +00:00
|
|
|
// qDebug() << "ObjectCreated Show" << object;
|
|
|
|
updateItemFlags(item, interface);
|
2013-04-16 11:34:18 +00:00
|
|
|
} else if (type == QAccessible::ScrollingStart) {
|
2011-10-11 09:04:59 +00:00
|
|
|
qDebug() << "ObjectCreated ScrollingStart" << object;
|
|
|
|
for (int i = 0; i < interface->childCount(); ++i) {
|
2012-01-17 19:02:18 +00:00
|
|
|
QAccessibleInterface *child = interface->child(i);
|
|
|
|
if (child) {
|
2011-10-11 09:04:59 +00:00
|
|
|
m_animatedObjects.insert(child->object());
|
|
|
|
}
|
|
|
|
}
|
2013-04-16 11:34:18 +00:00
|
|
|
} else if (type == QAccessible::ScrollingEnd) {
|
2011-10-11 09:04:59 +00:00
|
|
|
// qDebug() << "ObjectCreated ScrollingEnd" << object;
|
|
|
|
foreach (QObject *object, m_animatedObjects) {
|
|
|
|
updateItem(m_graphicsItems.value(object), interface);
|
|
|
|
}
|
|
|
|
m_animatedObjects.clear();
|
|
|
|
|
|
|
|
} else {
|
2011-11-22 17:08:05 +00:00
|
|
|
// qDebug() << "other update" << object;
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::setSelected(QObject *object)
|
|
|
|
{
|
|
|
|
m_scene->update(); // scedule update
|
|
|
|
|
|
|
|
// clear existing selection
|
|
|
|
if (m_selectedObject) {
|
|
|
|
QObject *previousSelectedObject = m_selectedObject;
|
|
|
|
m_selectedObject = 0;
|
|
|
|
updateItem(previousSelectedObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_selectedObject = object;
|
|
|
|
updateItem(object);
|
|
|
|
|
|
|
|
populateAccessibilityTreeScene();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::changeScale(int)
|
|
|
|
{
|
|
|
|
// No QGraphicsView::setScale :(
|
|
|
|
|
|
|
|
//m_view->scale(scale / 10.0, scale / 10.0);
|
|
|
|
//if (m_rootItem)
|
|
|
|
// m_view->ensureVisible(m_rootItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::updateItems(QObject *root)
|
|
|
|
{
|
|
|
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(root);
|
|
|
|
if (!interface)
|
|
|
|
return;
|
|
|
|
updateItem(m_graphicsItems.value(root), interface);
|
|
|
|
|
|
|
|
for (int i = 0; i < interface->childCount(); ++i) {
|
|
|
|
QAccessibleInterface *child = interface->child(i);
|
|
|
|
updateItems(child->object());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::updateItem(QObject *object)
|
|
|
|
{
|
|
|
|
if (!object)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(object);
|
|
|
|
if (!interface)
|
|
|
|
return;
|
|
|
|
|
|
|
|
updateItem(m_graphicsItems.value(object), interface);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::updateItem(QGraphicsRectItem *item, QAccessibleInterface *interface)
|
|
|
|
{
|
|
|
|
if (!item)
|
|
|
|
return;
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
QRect rect = interface->rect();
|
2011-10-11 09:04:59 +00:00
|
|
|
item->setPos(rect.topLeft());
|
|
|
|
item->setRect(QRect(QPoint(0,0), rect.size()));
|
|
|
|
|
|
|
|
updateItemFlags(item, interface);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::updateItemFlags(QGraphicsRectItem *item, QAccessibleInterface *interface)
|
|
|
|
{
|
|
|
|
// qDebug() << "udpateItemFlags" << interface << interface->object();
|
|
|
|
|
|
|
|
bool shouldShow = true;
|
|
|
|
|
|
|
|
if (m_optionsWidget->hideInvisibleItems()) {
|
|
|
|
if (isHidden(interface)) {
|
|
|
|
shouldShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_optionsWidget->hideOffscreenItems()) {
|
2012-01-17 19:02:18 +00:00
|
|
|
if (interface->state().offscreen) {
|
2011-10-11 09:04:59 +00:00
|
|
|
shouldShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_optionsWidget->hidePaneItems()) {
|
2011-12-01 18:50:15 +00:00
|
|
|
if (interface->role() & QAccessible::Pane) {
|
2011-10-11 09:04:59 +00:00
|
|
|
shouldShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-16 13:26:38 +00:00
|
|
|
if (m_optionsWidget->hideNullObjectItems()) {
|
|
|
|
if (interface->object() == 0) {
|
|
|
|
shouldShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_optionsWidget->hideNullRectItems()) {
|
|
|
|
if (interface->rect().isNull()) {
|
|
|
|
shouldShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-11 09:04:59 +00:00
|
|
|
item->setVisible(shouldShow);
|
|
|
|
|
2013-04-16 13:26:38 +00:00
|
|
|
if (interface->object() && interface->object() == m_selectedObject)
|
2011-10-11 09:04:59 +00:00
|
|
|
item->setBrush(QColor(Qt::yellow));
|
|
|
|
else
|
|
|
|
item->setBrush(QColor(Qt::white));
|
|
|
|
|
|
|
|
m_view->update();
|
|
|
|
}
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
QGraphicsRectItem * AccessibilitySceneManager::processInterface(QAccessibleInterface * interface, QGraphicsScene *scene)
|
2011-10-11 09:04:59 +00:00
|
|
|
{
|
|
|
|
// Process this interface
|
|
|
|
|
|
|
|
QGraphicsRectItem * item = new QGraphicsRectItem();
|
|
|
|
scene->addItem(item);
|
|
|
|
if (!m_rootItem)
|
|
|
|
m_rootItem = item;
|
|
|
|
|
2011-11-22 17:08:05 +00:00
|
|
|
QString name = interface->text(QAccessible::Name);
|
2011-10-11 09:04:59 +00:00
|
|
|
QString description; // = interface->text(QAccessibleInterface::Description, child);
|
2011-12-01 18:50:15 +00:00
|
|
|
QString role = translateRole(interface->role());
|
2011-10-11 09:04:59 +00:00
|
|
|
int childCount = interface->childCount();
|
|
|
|
|
|
|
|
/* qDebug() << "name:" << name << "local pos" <<
|
|
|
|
interface->rect(0) << "description" << description << "childCount" << childCount;
|
|
|
|
*/
|
|
|
|
|
|
|
|
updateItem(item, interface);
|
|
|
|
|
|
|
|
QGraphicsSimpleTextItem * textItem = new QGraphicsSimpleTextItem();
|
|
|
|
textItem->setParentItem(item);
|
|
|
|
textItem->setPos(QPoint(5, 5));
|
|
|
|
|
|
|
|
QString text;
|
|
|
|
text.append("Name: " + name + " ");
|
|
|
|
if (!description.isEmpty())
|
|
|
|
text.append("Description: " + description + " ");
|
|
|
|
text.append("Role: " + role + " ");
|
|
|
|
if (childCount > 0)
|
|
|
|
text.append("ChildCount: " + QString::number(childCount) + " ");
|
|
|
|
textItem->setText(text);
|
|
|
|
|
|
|
|
QFont font;
|
|
|
|
font.setPointSize(10);
|
|
|
|
// font.setPointSize(14);
|
|
|
|
textItem->setFont(font);
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
void AccessibilitySceneManager::populateAccessibilityScene(QAccessibleInterface * interface, QGraphicsScene *scene)
|
2011-10-11 09:04:59 +00:00
|
|
|
{
|
|
|
|
if (!interface)
|
|
|
|
return;
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
QGraphicsRectItem *item = processInterface(interface, scene);
|
2011-10-11 09:04:59 +00:00
|
|
|
|
|
|
|
QObject *object = interface->object();
|
|
|
|
if (object) {
|
|
|
|
m_graphicsItems.insert(object, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < interface->childCount(); ++i) {
|
|
|
|
QAccessibleInterface *child = interface->child(i);
|
|
|
|
updateItems(child->object());
|
2011-12-01 18:50:15 +00:00
|
|
|
populateAccessibilityScene(child, scene);
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AccessibilitySceneManager::TreeItem AccessibilitySceneManager::computeLevels(QAccessibleInterface * interface, int level)
|
|
|
|
{
|
|
|
|
if (interface == 0)
|
|
|
|
return TreeItem();
|
|
|
|
|
|
|
|
TreeItem currentLevel;
|
|
|
|
|
|
|
|
int usedChildren = 0;
|
|
|
|
for (int i = 0; i < interface->childCount(); ++i) {
|
|
|
|
QAccessibleInterface *child = interface->child(i);
|
|
|
|
if (child != 0) {
|
|
|
|
++usedChildren;
|
|
|
|
TreeItem childLevel = computeLevels(child, level + 1);
|
|
|
|
currentLevel.children.append(childLevel);
|
|
|
|
currentLevel.width += childLevel.width + m_treeItemHorizontalPadding;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// leaf node case
|
|
|
|
if (usedChildren == 0) {
|
|
|
|
currentLevel.width = m_treeItemWidth + m_treeItemHorizontalPadding;
|
|
|
|
}
|
|
|
|
|
|
|
|
// capture information:
|
2011-12-01 18:50:15 +00:00
|
|
|
currentLevel.name = interface->text(QAccessible::Name);
|
2011-12-01 20:32:37 +00:00
|
|
|
currentLevel.description += interface->text(QAccessible::DebugDescription);
|
2011-12-01 18:50:15 +00:00
|
|
|
currentLevel.role = translateRole(interface->role());
|
|
|
|
currentLevel.rect = interface->rect();
|
|
|
|
currentLevel.state = interface->state();
|
2011-10-11 09:04:59 +00:00
|
|
|
currentLevel.object = interface->object();
|
|
|
|
|
|
|
|
return currentLevel;
|
|
|
|
}
|
|
|
|
|
2011-12-01 18:50:15 +00:00
|
|
|
void AccessibilitySceneManager::populateAccessibilityTreeScene(QAccessibleInterface * interface)
|
2011-10-11 09:04:59 +00:00
|
|
|
{
|
|
|
|
if (!interface)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// set some layout metrics:
|
|
|
|
m_treeItemWidth = 90;
|
|
|
|
m_treeItemHorizontalPadding = 10;
|
|
|
|
m_treeItemHeight = 60;
|
|
|
|
m_treeItemVerticalPadding = 30;
|
|
|
|
|
|
|
|
// We want to draw the accessibility hiearchy as a vertical
|
|
|
|
// tree, growing from the root node at the top.
|
|
|
|
|
|
|
|
// First, figure out the number of levels and the width of each level:
|
|
|
|
m_rootTreeItem = computeLevels(interface, 0);
|
|
|
|
|
|
|
|
// create graphics items for each tree item
|
|
|
|
addGraphicsItems(m_rootTreeItem, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccessibilitySceneManager::addGraphicsItems(AccessibilitySceneManager::TreeItem item, int row, int xPos)
|
|
|
|
{
|
|
|
|
//qDebug() << "add graphics item" << row << item.name << item.role << xPos << item.width << item.children.count();
|
|
|
|
|
|
|
|
int yPos = row * (m_treeItemHeight + m_treeItemVerticalPadding);
|
|
|
|
|
|
|
|
// Process this interface
|
|
|
|
QGraphicsRectItem * graphicsItem = new QGraphicsRectItem();
|
|
|
|
graphicsItem->setPos(xPos, yPos);
|
|
|
|
graphicsItem->setRect(0, 0, m_treeItemWidth, m_treeItemHeight);
|
|
|
|
graphicsItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
|
|
|
|
|
2013-04-16 13:26:38 +00:00
|
|
|
if (item.object && item.object == m_selectedObject)
|
2011-10-11 09:04:59 +00:00
|
|
|
graphicsItem->setBrush(QColor(Qt::yellow));
|
|
|
|
else
|
|
|
|
graphicsItem->setBrush(QColor(Qt::white));
|
|
|
|
|
2012-01-17 19:02:18 +00:00
|
|
|
if (item.state.offscreen) {
|
2011-10-11 09:04:59 +00:00
|
|
|
QPen linePen;
|
|
|
|
linePen.setStyle(Qt::DashLine);
|
|
|
|
graphicsItem->setPen(linePen);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_treeScene->addItem(graphicsItem);
|
|
|
|
|
|
|
|
QGraphicsTextItem * textItem = new QGraphicsTextItem();
|
|
|
|
textItem->setParentItem(graphicsItem);
|
|
|
|
textItem->setPos(QPoint(0, 0));
|
|
|
|
|
|
|
|
QFont font;
|
|
|
|
font.setPointSize(8);
|
|
|
|
textItem->setFont(font);
|
|
|
|
|
|
|
|
QString text;
|
|
|
|
text += item.name + "\n";
|
|
|
|
text += item.role + "\n";
|
2020-02-25 16:22:09 +00:00
|
|
|
text += item.description.split(QLatin1Char(' '), Qt::SkipEmptyParts).join("\n") + "\n";
|
2011-10-11 09:04:59 +00:00
|
|
|
text += "P:" + QString::number(item.rect.x()) + " " + QString::number(item.rect.y()) + " ";
|
|
|
|
text += "S:" + QString::number(item.rect.width()) + " " + QString::number(item.rect.height()) + "\n";
|
|
|
|
|
|
|
|
textItem->setPlainText(text);
|
|
|
|
|
|
|
|
// recurse to children
|
|
|
|
int childIndex = 0;
|
|
|
|
int childCount = item.children.count();
|
|
|
|
int segmentSize = item.width / qMax(1, childCount);
|
|
|
|
int segmentCenterOffset = segmentSize / 2;
|
|
|
|
int segmentsStart = xPos - (item.width / 2);
|
|
|
|
foreach (TreeItem child, item.children) {
|
|
|
|
// spread the children out, covering the width, centered on xPos
|
|
|
|
int segmentPosition = segmentsStart + (segmentSize * childIndex) + segmentCenterOffset;
|
|
|
|
addGraphicsItems(child, row + 1, segmentPosition);
|
|
|
|
++childIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
// add lines from parents to kids
|
|
|
|
int boxBottom = yPos + m_treeItemHeight;
|
|
|
|
int boxMiddleX = xPos + m_treeItemWidth / 2;
|
|
|
|
int yBottomMiddle = boxBottom + m_treeItemVerticalPadding / 2;
|
|
|
|
int boxTop = yPos;
|
|
|
|
int yTopMiddle = boxTop - m_treeItemVerticalPadding / 2;
|
|
|
|
|
|
|
|
if (row > 0) {
|
|
|
|
QGraphicsLineItem *childVerticalStem = new QGraphicsLineItem();
|
|
|
|
childVerticalStem->setLine(boxMiddleX, yTopMiddle, boxMiddleX, boxTop);
|
|
|
|
m_treeScene->addItem(childVerticalStem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (childCount > 0) {
|
|
|
|
QGraphicsLineItem *parentVerticalStem = new QGraphicsLineItem();
|
|
|
|
parentVerticalStem->setLine(boxMiddleX, boxBottom, boxMiddleX, yBottomMiddle);
|
|
|
|
m_treeScene->addItem(parentVerticalStem);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (childCount > 1) {
|
|
|
|
QGraphicsLineItem *horizontalStem = new QGraphicsLineItem();
|
|
|
|
// match the end points with the horizontal lines
|
|
|
|
int lineStartX = segmentsStart + segmentCenterOffset + m_treeItemWidth / 2;
|
|
|
|
int lineStopX = segmentsStart + segmentSize * (childCount -1) + segmentCenterOffset + m_treeItemWidth / 2;
|
|
|
|
horizontalStem->setLine(lineStartX, yBottomMiddle, lineStopX , yBottomMiddle);
|
|
|
|
m_treeScene->addItem(horizontalStem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AccessibilitySceneManager::isHidden(QAccessibleInterface *interface)
|
|
|
|
{
|
|
|
|
QAccessibleInterface *current = interface;
|
|
|
|
while (current) {
|
|
|
|
|
2012-01-17 19:02:18 +00:00
|
|
|
if (current->state().invisible) {
|
2011-10-11 09:04:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-04-16 11:34:18 +00:00
|
|
|
current = current->parent();
|
2011-10-11 09:04:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|