diff options
Diffstat (limited to 'src/gui/accessible/qaccessible.h')
-rw-r--r-- | src/gui/accessible/qaccessible.h | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index b5a69702e1..0a92e76c73 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -8,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> @@ -42,6 +42,8 @@ class QAccessibleImageInterface; class QAccessibleTableInterface; class QAccessibleTableCellInterface; class QAccessibleHyperlinkInterface; +class QAccessibleSelectionInterface; +class QAccessibleAttributesInterface; class QAccessibleTableModelChangeEvent; class Q_GUI_EXPORT QAccessibleInterface @@ -102,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) @@ -265,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) @@ -287,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); @@ -299,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(); @@ -408,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; @@ -468,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; @@ -572,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 @@ -588,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 |