diff options
Diffstat (limited to 'src/plugins/accessible')
7 files changed, 0 insertions, 610 deletions
diff --git a/src/plugins/accessible/accessible.pro b/src/plugins/accessible/accessible.pro index 71165af784..77cba71ace 100644 --- a/src/plugins/accessible/accessible.pro +++ b/src/plugins/accessible/accessible.pro @@ -1,3 +1,2 @@ TEMPLATE = subdirs SUBDIRS += quick -SUBDIRS += qtquick1 diff --git a/src/plugins/accessible/qtquick1/main.cpp b/src/plugins/accessible/qtquick1/main.cpp deleted file mode 100644 index 12c6fcdc3a..0000000000 --- a/src/plugins/accessible/qtquick1/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeaccessible.h" -#include "qaccessibledeclarativeview.h" -#include "qaccessibledeclarativeitem.h" - -#include <QtQuick1/qdeclarativeitem.h> -#include <QtWidgets/qgraphicsview.h> - -#include <qaccessibleplugin.h> -#include <qplugin.h> -#include <qvariant.h> -#include <qaccessible.h> - -#ifndef QT_NO_ACCESSIBILITY - -QT_BEGIN_NAMESPACE - -class AccessibleQtQuick1Factory : public QAccessiblePlugin -{ -public: - AccessibleQtQuick1Factory(); - - QStringList keys() const; - QAccessibleInterface *create(const QString &classname, QObject *object); -}; - -AccessibleQtQuick1Factory::AccessibleQtQuick1Factory() -{ -} - -QStringList AccessibleQtQuick1Factory::keys() const -{ - QStringList list; - list << QLatin1String("QDeclarativeView"); - list << QLatin1String("QDeclarativeItem"); - return list; -} - -QAccessibleInterface *AccessibleQtQuick1Factory::create(const QString &classname, QObject *object) -{ - if (classname == QLatin1String("QDeclarativeView")) { - QWidget *widget = qobject_cast<QWidget*>(object); - if (qobject_cast<QDeclarativeView *>(widget) != 0) - return new QAccessibleDeclarativeView(widget); - } else if (classname == QLatin1String("QDeclarativeItem")) { - QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(object); - if (!item->scene()) - return 0; - - QList<QGraphicsView *> views = item->scene()->views(); - if (views.isEmpty()) - return 0; - QGraphicsView *view = views.at(0); // Accessibility support for the first view only. - // (Not a problem for QDeclarative) - return new QAccessibleDeclarativeItem(item, view); - } - - return 0; -} - -Q_EXPORT_STATIC_PLUGIN(AccessibleQtQuick1Factory) -Q_EXPORT_PLUGIN2(qtaccessibleqtquick1, AccessibleQtQuick1Factory) - -QT_END_NAMESPACE - -#endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp deleted file mode 100644 index 6748e2602f..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qaccessibledeclarativeitem.h" - -#include <QtQuick1/qdeclarativeitem.h> -#include <QtQuick1/private/qdeclarativeaccessibleattached_p.h> - -QT_BEGIN_NAMESPACE - -QAccessibleDeclarativeItem::QAccessibleDeclarativeItem(QGraphicsObject *item, QGraphicsView *view) - :QDeclarativeAccessible(item) - ,m_item(item) - ,m_view(view) -{ - -} - -int QAccessibleDeclarativeItem::childCount() const -{ - QList<QGraphicsItem *> children = m_item->childItems(); - return children.count(); -} - -QRect QAccessibleDeclarativeItem::rect() const -{ - QRectF sceneRect = m_item->sceneTransform().mapRect(m_item->boundingRect()); - QPoint pos = m_view->mapFromScene(m_view->mapToGlobal(sceneRect.topLeft().toPoint())); - QSize size = sceneRect.size().toSize(); - return QRect(pos, size); -} - -QRect QAccessibleDeclarativeItem::viewRect() const -{ - QPoint screenPos = m_view->mapToGlobal(m_view->pos()); - return QRect(screenPos, m_view->size()); -} - -bool QAccessibleDeclarativeItem::clipsChildren() const -{ - return static_cast<QDeclarativeItem *>(m_item)->clip(); -} - -static inline bool isAncestor(const QObject *ancestorCandidate, const QObject *child) -{ - while (child) { - if (child == ancestorCandidate) - return true; - child = child->parent(); - } - return false; -} - - -QAccessibleInterface *QAccessibleDeclarativeItem::parent() const -{ - QGraphicsItem *parent = m_item->parentItem(); - QGraphicsObject *parentObj = parent ? parent->toGraphicsObject() : 0; - if (parent && !parentObj) - qWarning("Can not make QGraphicsItems accessible"); - QAccessibleInterface *ancestor = (parentObj - ? new QAccessibleDeclarativeItem(parentObj, m_view) - : QAccessible::queryAccessibleInterface(m_view)); - return ancestor; -} - -QAccessibleInterface *QAccessibleDeclarativeItem::child(int index) const -{ - QList<QGraphicsItem *> children = m_item->childItems(); - - if (index >= children.count()) - return 0; - - QGraphicsItem *child = children.at(index); - QGraphicsObject *childObject = qobject_cast<QGraphicsObject *>(child); - if (!childObject) - return 0; - - return new QAccessibleDeclarativeItem(childObject, m_view); -} - -int QAccessibleDeclarativeItem::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const -{ - Q_UNUSED(rel); - Q_UNUSED(entry); - *target = 0; - return -1; -} - -/*! \reimp */ -QAccessibleInterface *QAccessibleDeclarativeItem::focusChild() const -{ - QGraphicsObject *focusObject = 0; - if (m_item->hasFocus()) { - focusObject = m_item->toGraphicsObject(); - } else { - if (QGraphicsScene *scene = m_view->scene()) { - if (QGraphicsItem *focusItem = scene->focusItem()) { - if (m_item->isAncestorOf(focusItem)) { - focusObject = focusItem->toGraphicsObject(); - } - } - } - } - if (focusObject) - return new QAccessibleDeclarativeItem(focusObject, m_view); //###queryAccessibleInterface? - return 0; -} - -int QAccessibleDeclarativeItem::indexOfChild(const QAccessibleInterface *iface) const -{ - // ### No QAccessibleInterfaces are created with a QGraphicsItem. - // However, we want to support QML, not QGraphicsView in general. - // And since the UI is written in QML, this means we can assume that *all* - // QGraphicsItems are actually QGraphicsObjects - - const QGraphicsObject *childObj = static_cast<QGraphicsObject*>(iface->object()); - if (m_item == childObj) - return 0; - - QList<QGraphicsItem*> kids = m_item->childItems(); - int index = kids.indexOf(const_cast<QGraphicsItem*>(static_cast<const QGraphicsItem*>(childObj))); - if (index != -1) { - ++index; - } - return index; -} - -QAccessible::State QAccessibleDeclarativeItem::state() const -{ - QAccessible::State state; - state.focused = m_item->hasFocus(); - return state; -} - -QAccessible::Role QAccessibleDeclarativeItem::role() const -{ - // ### Workaround for setAccessibleRole() not working. - // Text items are special since they are defined - // entirely from C++ (setting the role from QML works.) -// if (qobject_cast<QDeclarative1Text*>(m_item)) -// return QAccessible::StaticText; - - QVariant v = QDeclarativeAccessibleAttached::property(m_item, "role"); - bool ok; - QAccessible::Role role = (QAccessible::Role)v.toInt(&ok); - if (!ok) // Not sure if this check is needed. - role = QAccessible::Pane; - return role; -} - -bool QAccessibleDeclarativeItem::isAccessible() const -{ - return true; -} - -QString QAccessibleDeclarativeItem::text(QAccessible::Text textType) const -{ - // handles generic behaviour not specific to an item - switch (textType) { - case QAccessible::Name: { - QVariant accessibleName = QDeclarativeAccessibleAttached::property(object(), "name"); - if (!accessibleName.isNull()) - return accessibleName.toString(); - break;} - case QAccessible::Description: { - QVariant accessibleDecription = QDeclarativeAccessibleAttached::property(object(), "description"); - if (!accessibleDecription.isNull()) - return accessibleDecription.toString(); - break;} - case QAccessible::Value: - case QAccessible::Help: - case QAccessible::Accelerator: - default: - break; - } - - // the following blocks handles item-specific behaviour - if (role() == QAccessible::EditableText) { - if (textType == QAccessible::Value) { - QVariant text = object()->property("text"); - return text.toString(); - } else if (textType == QAccessible::Name) { - return object()->objectName(); - } - } else { - if (textType == QAccessible::Name) { - QVariant text = object()->property("text"); - return text.toString(); - } - } - - - return QString(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h deleted file mode 100644 index 45bf6f941a..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeitem.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QACCESSIBLEDECLARATIVEITEM_H -#define QACCESSIBLEDECLARATIVEITEM_H - -#include "qdeclarativeaccessible.h" - -#include <QtWidgets/qgraphicsview.h> -#include <QtWidgets/qgraphicsitem.h> - -QT_BEGIN_NAMESPACE - -class QAccessibleDeclarativeItem : public QDeclarativeAccessible -{ -public: - QAccessibleDeclarativeItem(QGraphicsObject *item, QGraphicsView *view); - - QRect rect() const; - QRect viewRect() const; - - bool clipsChildren() const; - - QAccessibleInterface *focusChild() const; - - QAccessibleInterface *parent() const; - QAccessibleInterface *child(int index) const; - int childCount() const; - int navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const; - int indexOfChild(const QAccessibleInterface *iface) const; - - QAccessible::State state() const; - QAccessible::Role role() const; - QString text(QAccessible::Text) const; - - virtual bool isAccessible() const; -private: - QGraphicsObject *m_item; - QGraphicsView *m_view; -}; - -QT_END_NAMESPACE - -#endif // QACCESSIBLEGRAPHICSVIEWIMPLEMENTATION_H diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp deleted file mode 100644 index e5b78a4517..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qaccessibledeclarativeview.h" -#include "qdeclarativeaccessible.h" -#include "qaccessibledeclarativeitem.h" - - -#ifndef QT_NO_ACCESSIBILITY - -QT_BEGIN_NAMESPACE - -QAccessibleDeclarativeView::QAccessibleDeclarativeView(QWidget *widget) - :QAccessibleWidget(widget) -{ - m_view = static_cast<QDeclarativeView *>(widget); -} - -int QAccessibleDeclarativeView::childCount() const -{ - return 1; -} - -QAccessibleInterface *QAccessibleDeclarativeView::child(int index) const -{ - if (index == 0) { - QDeclarativeItem *declarativeRoot = m_view->accessibleRootItem(); - return new QAccessibleDeclarativeItem(declarativeRoot, m_view); - } - return 0; -} - -QAccessibleInterface *QAccessibleDeclarativeView::childAt(int x, int y) const -{ - Q_UNUSED(x); - Q_UNUSED(y); - return child(0); // return the top-level QML item -} - -int QAccessibleDeclarativeView::indexOfChild(const QAccessibleInterface *iface) const -{ - if (iface) { - QDeclarativeItem *declarativeRoot = m_view->accessibleRootItem(); - if (declarativeRoot == iface->object()) - return 0; - } - return -1; -} - -QT_END_NAMESPACE - -#endif // QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h b/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h deleted file mode 100644 index d6fc0e2384..0000000000 --- a/src/plugins/accessible/qtquick1/qaccessibledeclarativeview.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QACCESSIBLEDECLARATIVEVIEW_H -#define QACCESSIBLEDECLARATIVEVIEW_H - -#include <QtGui/qaccessible2.h> -#include <QtWidgets/qaccessiblewidget.h> - -#include <QtQuick1/qdeclarativeview.h> -#include <QtQuick1/qdeclarativeitem.h> -#include <QtWidgets/qwidget.h> - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_ACCESSIBILITY - -class QAccessibleDeclarativeView: public QAccessibleWidget -{ -public: - explicit QAccessibleDeclarativeView(QWidget *widget); - - QAccessibleInterface *child(int index) const; - int childCount() const; - QAccessibleInterface *childAt(int x, int y) const; - int indexOfChild(const QAccessibleInterface *iface) const; - -private: - QDeclarativeView *m_view; -}; - -#endif // QT_NO_ACCESSIBILITY - -QT_END_NAMESPACE - -#endif // QACCESSIBLEDECLARATIVEVIEW_H diff --git a/src/plugins/accessible/qtquick1/qtquick1.pro b/src/plugins/accessible/qtquick1/qtquick1.pro deleted file mode 100644 index f4602e4420..0000000000 --- a/src/plugins/accessible/qtquick1/qtquick1.pro +++ /dev/null @@ -1,22 +0,0 @@ -contains(QT_CONFIG, accessibility) { - -TARGET = qtaccessibleqtquick1 -load(qt_plugin) -include ($$PWD/../shared/qaccessiblebase.pri) - -QT += core-private gui-private widgets-private v8-private declarative-private qtquick1-private -DESTDIR = $$QT.gui.plugins/accessible - -QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" - -DEFINES+=Q_ACCESSIBLE_QUICK_ITEM_ENABLE_DEBUG_DESCRIPTION - -SOURCES += \ - main.cpp \ - qaccessibledeclarativeview.cpp \ - qaccessibledeclarativeitem.cpp - -HEADERS += \ - qaccessibledeclarativeview.h \ - qaccessibledeclarativeitem.h -} |