diff options
Diffstat (limited to 'src/gui/accessible/qaccessible.h')
-rw-r--r-- | src/gui/accessible/qaccessible.h | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 3fa7f19af1..0a92e76c73 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #if 0 @@ -44,11 +8,11 @@ #pragma qt_class(QAccessible) #endif -#include <QtGui/qtguiglobal.h> - -#ifndef QT_NO_ACCESSIBILITY #ifndef QACCESSIBLE_H #define QACCESSIBLE_H +#include <QtGui/qtguiglobal.h> + +#if QT_CONFIG(accessibility) #include <QtCore/qcoreapplication.h> #include <QtCore/qdebug.h> @@ -78,6 +42,8 @@ class QAccessibleImageInterface; class QAccessibleTableInterface; class QAccessibleTableCellInterface; class QAccessibleHyperlinkInterface; +class QAccessibleSelectionInterface; +class QAccessibleAttributesInterface; class QAccessibleTableModelChangeEvent; class Q_GUI_EXPORT QAccessibleInterface @@ -138,6 +104,12 @@ public: inline QAccessibleHyperlinkInterface *hyperlinkInterface() { return reinterpret_cast<QAccessibleHyperlinkInterface *>(interface_cast(QAccessible::HyperlinkInterface)); } + inline QAccessibleSelectionInterface *selectionInterface() + { return reinterpret_cast<QAccessibleSelectionInterface *>(interface_cast(QAccessible::SelectionInterface)); } + + inline QAccessibleAttributesInterface *attributesInterface() + { return reinterpret_cast<QAccessibleAttributesInterface *>(interface_cast(QAccessible::AttributesInterface)); } + virtual void virtual_hook(int id, void *data); virtual void *interface_cast(QAccessible::InterfaceType) @@ -301,6 +273,30 @@ public: virtual bool isValid() const = 0; }; +class Q_GUI_EXPORT QAccessibleSelectionInterface +{ +public: + virtual ~QAccessibleSelectionInterface(); + + virtual int selectedItemCount() const = 0; + virtual QList<QAccessibleInterface*> selectedItems() const = 0; + virtual QAccessibleInterface* selectedItem(int selectionIndex) const; + virtual bool isSelected(QAccessibleInterface *childItem) const; + virtual bool select(QAccessibleInterface *childItem) = 0; + virtual bool unselect(QAccessibleInterface *childItem) = 0; + virtual bool selectAll() = 0; + virtual bool clear() = 0; +}; + +class Q_GUI_EXPORT QAccessibleAttributesInterface +{ +public: + virtual ~QAccessibleAttributesInterface(); + virtual QList<QAccessible::Attribute> attributeKeys() const = 0; + virtual QVariant attributeValue(QAccessible::Attribute key) const = 0; +}; + + class Q_GUI_EXPORT QAccessibleEvent { Q_DISABLE_COPY(QAccessibleEvent) @@ -323,7 +319,7 @@ public: } inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ) - : m_type(typ), m_object(nullptr) + : m_type(typ) { Q_ASSERT(iface); Q_ASSERT(m_type != QAccessible::ValueChanged); @@ -335,6 +331,7 @@ public: Q_ASSERT(m_type != QAccessible::TextUpdated); Q_ASSERT(m_type != QAccessible::TableModelChanged); m_uniqueId = QAccessible::uniqueId(iface); + m_object = iface->object(); } virtual ~QAccessibleEvent(); @@ -444,13 +441,13 @@ class Q_GUI_EXPORT QAccessibleTextInsertEvent : public QAccessibleTextCursorEven { public: inline QAccessibleTextInsertEvent(QObject *obj, int position, const QString &text) - : QAccessibleTextCursorEvent(obj, position + int(text.length())) + : QAccessibleTextCursorEvent(obj, position + int(text.size())) , m_position(position), m_text(text) { m_type = QAccessible::TextInserted; } inline QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text) - : QAccessibleTextCursorEvent(iface, position + int(text.length())) + : QAccessibleTextCursorEvent(iface, position + int(text.size())) , m_position(position), m_text(text) { m_type = QAccessible::TextInserted; @@ -504,13 +501,13 @@ class Q_GUI_EXPORT QAccessibleTextUpdateEvent : public QAccessibleTextCursorEven { public: inline QAccessibleTextUpdateEvent(QObject *obj, int position, const QString &oldText, const QString &text) - : QAccessibleTextCursorEvent(obj, position + int(text.length())) + : QAccessibleTextCursorEvent(obj, position + int(text.size())) , m_position(position), m_oldText(oldText), m_text(text) { m_type = QAccessible::TextUpdated; } inline QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText, const QString &text) - : QAccessibleTextCursorEvent(iface, position + int(text.length())) + : QAccessibleTextCursorEvent(iface, position + int(text.size())) , m_position(position), m_oldText(oldText), m_text(text) { m_type = QAccessible::TextUpdated; @@ -608,7 +605,7 @@ protected: int m_lastColumn; }; -#ifndef Q_CLANG_QDOC +#ifndef Q_QDOC #define QAccessibleInterface_iid "org.qt-project.Qt.QAccessibleInterface" Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid) #endif @@ -624,5 +621,5 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleEvent &ev); QT_END_NAMESPACE +#endif // QT_CONFIG(accessibility) #endif // QACCESSIBLE_H -#endif //!QT_NO_ACCESSIBILITY |