From 1e37a053ed6d52cd2ea662f84c97c718b38367c9 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 30 Nov 2011 17:07:39 +0100 Subject: Create a class to contain accessibilty enums. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed in order to expose the enums to qml. Do not inherit QAccessible. Change-Id: I220a0ea3add2d790e4fa6e93ce3deda762859e1a Reviewed-by: Morten Johan Sørvig --- src/gui/accessible/qaccessible.h | 45 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'src/gui/accessible/qaccessible.h') diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index dca398a9f7..6ee1885a3d 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -62,9 +62,16 @@ QT_MODULE(Gui) class QAccessibleInterface; class QWindow; +// We need to inherit QObject to expose the enums to QML. class Q_GUI_EXPORT QAccessible +#ifndef qdoc + :public QObject +#endif { + Q_OBJECT + Q_ENUMS(Role Event State) public: + enum Event { SoundPlayed = 0x0001, Alert = 0x0002, @@ -141,6 +148,7 @@ public: AcceleratorChanged = 0x80C0 }; + enum StateFlag { Normal = 0x00000000, Unavailable = 0x00000001, @@ -152,11 +160,11 @@ public: ReadOnly = 0x00000040, HotTracked = 0x00000080, DefaultButton = 0x00000100, - // #### Qt5 Expandable Expanded = 0x00000200, Collapsed = 0x00000400, Busy = 0x00000800, // Floating = 0x00001000, + Expandable = 0x00001000, Marqueed = 0x00002000, Animated = 0x00004000, Invisible = 0x00008000, @@ -180,6 +188,7 @@ public: }; Q_DECLARE_FLAGS(State, StateFlag) + enum Role { NoRole = 0x00000000, TitleBar = 0x00000001, @@ -224,7 +233,10 @@ public: Graphic = 0x00000028, StaticText = 0x00000029, EditableText = 0x0000002A, // Editable, selectable, etc. - PushButton = 0x0000002B, + Button = 0x0000002B, +#ifndef qdoc + PushButton = Button, // deprecated +#endif CheckBox = 0x0000002C, RadioButton = 0x0000002D, ComboBox = 0x0000002E, @@ -321,6 +333,12 @@ public: private: static UpdateHandler updateHandler; static RootObjectHandler rootObjectHandler; + + /*! @internal + This class is purely a collection of enums and static functions, + it is not supposed to be instantiated. + */ + QAccessible() {} }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::State) @@ -338,7 +356,7 @@ class QAccessibleImageInterface; class QAccessibleTableInterface; class QAccessibleTableCellInterface; -class Q_GUI_EXPORT QAccessibleInterface : public QAccessible +class Q_GUI_EXPORT QAccessibleInterface { public: virtual ~QAccessibleInterface() {} @@ -348,8 +366,8 @@ public: virtual QWindow *window() const; // relations - virtual Relation relationTo(const QAccessibleInterface *other) const; - virtual QVector > relations() const; + virtual QAccessible::Relation relationTo(const QAccessibleInterface *other) const; + virtual QVector > relations() const; virtual int childAt(int x, int y) const = 0; @@ -358,22 +376,23 @@ public: virtual QAccessibleInterface *child(int index) const = 0; virtual int childCount() const = 0; virtual int indexOfChild(const QAccessibleInterface *) const = 0; - virtual int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const = 0; + virtual int navigate(QAccessible::RelationFlag relation, int index, QAccessibleInterface **iface) const = 0; // properties and state - virtual QString text(Text t) const = 0; - virtual void setText(Text t, const QString &text) = 0; + virtual QString text(QAccessible::Text t) const = 0; + virtual void setText(QAccessible::Text t, const QString &text) = 0; virtual QRect rect() const = 0; - virtual Role role() const = 0; - virtual State state() const = 0; + virtual QAccessible::Role role() const = 0; + virtual QAccessible::State state() const = 0; + // FIXME virtual QSet states() const = 0; virtual QColor foregroundColor() const; virtual QColor backgroundColor() const; - virtual QVariant invokeMethod(Method method, const QVariantList ¶ms = QVariantList()); + virtual QVariant invokeMethod(QAccessible::Method method, const QVariantList ¶ms = QVariantList()); - inline QSet supportedMethods() - { return qvariant_cast >(invokeMethod(ListSupportedMethods)); } + inline QSet supportedMethods() + { return qvariant_cast >(invokeMethod(QAccessible::ListSupportedMethods)); } inline QAccessibleTextInterface *textInterface() { return reinterpret_cast(interface_cast(QAccessible::TextInterface)); } -- cgit v1.2.3