Qt 4.8
qaccessiblewidgets.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QACCESSIBLEWIDGETS_H
43 #define QACCESSIBLEWIDGETS_H
44 
45 #include <QtGui/qaccessible2.h>
46 #include <QtGui/qaccessiblewidget.h>
47 
48 #ifndef QT_NO_ACCESSIBILITY
49 
50 #include <QtCore/QPointer>
51 #include <QtCore/QPair>
52 
54 
55 class QTextEdit;
56 class QStackedWidget;
57 class QToolBox;
58 class QMdiArea;
59 class QMdiSubWindow;
60 class QWorkspace;
61 class QRubberBand;
62 class QTextBrowser;
63 class QCalendarWidget;
64 class QAbstractItemView;
65 class QDockWidget;
66 class QDockWidgetLayout;
67 class QMainWindow;
68 class QPlainTextEdit;
69 class QTextCursor;
70 class QTextDocument;
71 
75 {
76 public:
78  void addSelection(int startOffset, int endOffset);
79  void setSelection(int selectionIndex, int startOffset, int endOffset);
80  void removeSelection(int selectionIndex);
81  void selection(int selectionIndex, int *startOffset, int *endOffset);
82  int selectionCount();
83 
84  int characterCount();
85 
86  void setCursorPosition(int position);
87  int cursorPosition();
88 
89  QString text(int startOffset, int endOffset);
90 
91  QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
92  int *startOffset, int *endOffset);
93  QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
94  int *startOffset, int *endOffset);
95  QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
96  int *startOffset, int *endOffset);
97 
98  QString attributes(int offset, int *startOffset, int *endOffset);
99 
100  void deleteText(int startOffset, int endOffset);
101  void insertText(int offset, const QString &text);
102 
103  void copyText(int startOffset, int endOffset);
104  void cutText(int startOffset, int endOffset);
105  void pasteText(int offset);
106  void setAttributes(int startOffset, int endOffset, const QString &attributes);
107 
108  void replaceText(int startOffset, int endOffset, const QString &text);
109 
110  QRect characterRect(int offset, QAccessible2::CoordinateType coordType);
111  int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType);
112 protected:
113  QTextCursor textCursorForRange(int startOffset, int endOffset) const;
114  QPair<int, int> getBoundaries(int offset, QAccessible2::BoundaryType boundaryType);
115  virtual QPoint scrollBarPosition() const;
116  virtual QTextCursor textCursor() const = 0;
117  virtual void setTextCursor(const QTextCursor &) = 0;
118  virtual QTextDocument *textDocument() const = 0;
119  virtual QWidget *viewport() const = 0;
120 };
121 
123 {
125 public:
126  explicit QAccessiblePlainTextEdit(QWidget *o);
127 
128  int childCount() const;
129 
130  // QAccessibleTextInterface
131  void scrollToSubstring(int startIndex, int endIndex);
132 protected:
133  QPlainTextEdit *plainTextEdit() const;
134 
135  QPoint scrollBarPosition() const;
136  QTextCursor textCursor() const;
137  void setTextCursor(const QTextCursor &textCursor);
138  QTextDocument *textDocument() const;
139  QWidget *viewport() const;
140 };
141 
142 #ifndef QT_NO_TEXTEDIT
144 {
146 public:
147  explicit QAccessibleTextEdit(QWidget *o);
148 
149  QString text(Text t, int child) const;
150  void setText(Text t, int control, const QString &text);
151  Role role(int child) const;
152 
153  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
154 
155  QRect rect(int child) const;
156  int childAt(int x, int y) const;
157 
158  int childCount() const;
159 
160  // QAccessibleTextInterface
161  void scrollToSubstring(int startIndex, int endIndex);
162 
163  // QAccessibleEditableTextInterface
164  void copyText(int startOffset, int endOffset);
165  void cutText(int startOffset, int endOffset);
166  void pasteText(int offset);
167  void setAttributes(int startOffset, int endOffset, const QString &attributes);
168 
169 protected:
170  QTextEdit *textEdit() const;
171 
172  QPoint scrollBarPosition() const;
173  QTextCursor textCursor() const;
174  void setTextCursor(const QTextCursor &textCursor);
175  QTextDocument *textDocument() const;
176  QWidget *viewport() const;
177 private:
179 };
180 #endif // QT_NO_TEXTEDIT
181 
183 {
185 public:
187 
188  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
189  int childAt(int x, int y) const;
190  int childCount() const;
191  int indexOfChild(const QAccessibleInterface *child) const;
192  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
193 
194 protected:
195  QStackedWidget *stackedWidget() const;
196 };
197 
199 {
201 public:
202  explicit QAccessibleToolBox(QWidget *widget);
203 
204  QString text(Text textType, int child) const;
205  void setText(Text textType, int child, const QString &text);
206  State state(int child) const;
207  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
208  int childCount() const;
209  int indexOfChild(const QAccessibleInterface *child) const;
210  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
211 
212 protected:
213  QToolBox *toolBox() const;
214 };
215 
216 #ifndef QT_NO_MDIAREA
218 {
219 public:
220  explicit QAccessibleMdiArea(QWidget *widget);
221 
222  State state(int child) const;
223  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
224  int childCount() const;
225  int indexOfChild(const QAccessibleInterface *child) const;
226  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
227 
228 protected:
229  QMdiArea *mdiArea() const;
230 };
231 
233 {
234 public:
236 
237  QString text(Text textType, int child) const;
238  void setText(Text textType, int child, const QString &text);
239  State state(int child) const;
240  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
241  int childCount() const;
242  int indexOfChild(const QAccessibleInterface *child) const;
243  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
244  QRect rect(int child) const;
245  int childAt(int x, int y) const;
246 
247 protected:
248  QMdiSubWindow *mdiSubWindow() const;
249 };
250 #endif // QT_NO_MDIAREA
251 
252 #ifndef QT_NO_WORKSPACE
254 {
255 public:
257 
258  State state(int child) const;
259  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
260  int childCount() const;
261  int indexOfChild(const QAccessibleInterface *child) const;
262  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
263 
264 protected:
265  QWorkspace *workspace() const;
266 };
267 #endif
268 
270 {
271 public:
273 
274  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
275 };
276 
277 #ifndef QT_NO_TEXTBROWSER
279 {
280 public:
282 
283  Role role(int child) const;
284 };
285 #endif // QT_NO_TEXTBROWSER
286 
287 #ifndef QT_NO_CALENDARWIDGET
289 {
290 public:
292 
293  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
294  int childCount() const;
295  int indexOfChild(const QAccessibleInterface *child) const;
296  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
297  QRect rect(int child) const;
298  int childAt(int x, int y) const;
299 
300 protected:
301  QCalendarWidget *calendarWidget() const;
302 
303 private:
304  QAbstractItemView *calendarView() const;
305  QWidget *navigationBar() const;
306 };
307 #endif // QT_NO_CALENDARWIDGET
308 
309 #ifndef QT_NO_DOCKWIDGET
311 {
312 public:
314  int navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const;
315  int indexOfChild(const QAccessibleInterface *child) const;
316  int childCount() const;
317  QRect rect (int child ) const;
318  Role role(int child) const;
319  State state(int child) const;
320  int childAt(int x, int y) const;
321 
322  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
323  QDockWidget *dockWidget() const;
324 };
325 
327 {
328 public:
330  QString actionText(int action, Text t, int child) const;
331  bool doAction(int action, int child, const QVariantList& params = QVariantList());
332  int userActionCount ( int child) const;
333  int navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const;
334  int indexOfChild(const QAccessibleInterface *child) const;
335  int childCount() const;
336  Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
337  void setText(Text t, int child, const QString &text);
338  QString text(Text t, int child) const;
339  Role role(int child) const;
340  QRect rect (int child) const;
341  State state(int child) const;
342  int childAt(int x, int y) const;
343  QObject *object() const;
344  bool isValid() const;
345 
346 
348 
349  QDockWidget *dockWidget() const;
350  QDockWidgetLayout *dockWidgetLayout() const;
351 };
352 
353 #endif // QT_NO_DOCKWIDGET
354 
355 #ifndef QT_NO_MAINWINDOW
357 {
358 public:
360 
361  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
362  int childCount() const;
363  int navigate(RelationFlag relation, int entry, QAccessibleInterface **iface) const;
364  int indexOfChild(const QAccessibleInterface *iface) const;
365  int childAt(int x, int y) const;
366  QMainWindow *mainWindow() const;
367 
368 };
369 #endif //QT_NO_MAINWINDOW
370 
371 #endif // QT_NO_ACCESSIBILITY
372 
374 
375 #endif // QACESSIBLEWIDGETS_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
void cutText(int startOffset, int endOffset)
The QAccessibleEditableTextInterface class implements support for the IAccessibleEditableText interfa...
Definition: qaccessible2.h:160
The QToolBox class provides a column of tabbed widget items.
Definition: qtoolbox.h:58
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
int indexOfChild(const QAccessibleInterface *child) const
Returns the 1-based index of the object child in this object&#39;s children list, or -1 if child is not a...
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QTextCursor textCursorForRange(int startOffset, int endOffset) const
virtual QTextCursor textCursor() const =0
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition: qdockwidget.h:60
QAccessibleTextWidget(QWidget *o, Role r=EditableText, const QString &name=QString())
int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType)
QString text(int startOffset, int endOffset)
QObject * object() const
Returns a pointer to the QObject this interface implementation provides information for...
QString actionText(int action, Text t, int child) const
Returns the text property t of the action action supported by the object, or of the object&#39;s child if...
The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date...
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
int childAt(int x, int y) const
Returns the 1-based index of the child that contains the screen coordinates (x, y).
virtual void setTextCursor(const QTextCursor &)=0
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void insertText(int offset, const QString &text)
int userActionCount(int child) const
Returns the number of custom actions of the object, or of the object&#39;s child if child is not 0...
void setCursorPosition(int position)
The QString class provides a Unicode character string.
Definition: qstring.h:83
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const
Returns the relationship between this object&#39;s \a child and the \a other object&#39;s \a otherChild...
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QPair< int, int > getBoundaries(int offset, QAccessible2::BoundaryType boundaryType)
void setText(Text t, int child, const QString &text)
Sets the text property t of the object, or of the object&#39;s child if child is not 0, to text.
The QWorkspace widget provides a workspace window that can be used in an MDI application.
Definition: qworkspace.h:60
void setAttributes(int startOffset, int endOffset, const QString &attributes)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
void deleteText(int startOffset, int endOffset)
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70
RelationFlag
This enum type defines bit flags that can be combined to indicate the relationship between two access...
Definition: qaccessible.h:268
Method
This enum describes the possible types of methods that can be invoked on an accessible object...
Definition: qaccessible.h:311
const char * name
The QMdiArea widget provides an area in which MDI windows are displayed.
Definition: qmdiarea.h:59
QString attributes(int offset, int *startOffset, int *endOffset)
#define Q_ACCESSIBLE_OBJECT
Definition: qaccessible2.h:108
QRect characterRect(int offset, QAccessible2::CoordinateType coordType)
The QPlainTextEdit class provides a widget that is used to edit and display plain text...
The State element defines configurations of objects and properties.
int childCount() const
Returns the number of children that belong to this object.
QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
virtual QTextDocument * textDocument() const =0
void addSelection(int startOffset, int endOffset)
virtual QWidget * viewport() const =0
The QAbstractItemView class provides the basic functionality for item view classes.
The QAccessibleTextEdit class implements the QAccessibleInterface for richtext editors.
QVariant invokeMethodEx(Method method, int child, const QVariantList &params)
void selection(int selectionIndex, int *startOffset, int *endOffset)
virtual QPoint scrollBarPosition() const
QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
The QAccessibleTextInterface class implements support for the IAccessibleText interface.
Definition: qaccessible2.h:132
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
QWidget * widget() const
QList< QVariant > QVariantList
Definition: qvariant.h:443
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QTextBrowser class provides a rich text browser with hypertext navigation.
Definition: qtextbrowser.h:58
The QMainWindow class provides a main application window.
Definition: qmainwindow.h:63
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void removeSelection(int selectionIndex)
QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset)
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
void replaceText(int startOffset, int endOffset, const QString &text)
bool isValid() const
Returns true if all the data necessary to use this interface implementation is valid (e...
bool doAction(int action, int child, const QVariantList &params)
Asks the object, or the object&#39;s child if child is not 0, to execute action using the parameters...
int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship relation to this object, and returns the respective object in target.
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
void copyText(int startOffset, int endOffset)
The QStackedWidget class provides a stack of widgets where only one widget is visible at a time...
virtual void scrollToSubstring(int startIndex, int endIndex)=0
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary...
Definition: qrubberband.h:58
QPointer< QDockWidget > m_dockWidget
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
The QTextEdit class provides a widget that is used to edit and display both plain and rich text...
Definition: qtextedit.h:70
The Text item allows you to add formatted text to a scene.
void setSelection(int selectionIndex, int startOffset, int endOffset)