Qt 4.8
complexwidgets.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 COMPLEXWIDGETS_H
43 #define COMPLEXWIDGETS_H
44 
45 #include <QtCore/qpointer.h>
46 #include <QtGui/qaccessiblewidget.h>
47 #include <QtGui/qabstractitemview.h>
48 #include <QtGui/qaccessible2.h>
49 
51 
52 #ifndef QT_NO_ACCESSIBILITY
53 
54 class QAbstractButton;
55 class QHeaderView;
56 class QTabBar;
57 class QComboBox;
58 class QTitleBar;
60 class QScrollArea;
61 
62 #ifndef QT_NO_SCROLLAREA
64 {
65 public:
67 
69  Self = 0,
75  };
76 
77  QString text(Text textType, int child) const;
78  void setText(Text textType, int child, const QString &text);
79  State state(int child) const;
80  QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params);
81  int childCount() const;
82  int indexOfChild(const QAccessibleInterface *child) const;
83  bool isValid() const;
84  int navigate(RelationFlag relation, int entry, QAccessibleInterface **target) const;
85  QRect rect(int child) const;
86  int childAt(int x, int y) const;
87 
88 //protected:
90 
91 private:
94  bool isLeftToRight() const;
95 };
96 
98 {
99 public:
101 };
102 
103 #endif // QT_NO_SCROLLAREA
104 
105 #ifndef QT_NO_ITEMVIEWS
107 {
109 public:
110  explicit QAccessibleHeader(QWidget *w);
111 
112  int childCount() const;
113 
114  QRect rect(int child) const;
115  QString text(Text t, int child) const;
116  Role role(int child) const;
117  State state(int child) const;
118 
119 protected:
120  QHeaderView *header() const;
121 };
122 
124 {
125  friend class QAccessibleItemView;
126 public:
127  QAccessibleItemRow(QAbstractItemView *view, const QModelIndex &index = QModelIndex(), bool isHeader = false);
128  QRect rect(int child) const;
129  QString text(Text t, int child) const;
130  void setText(Text t, int child, const QString &text);
131  bool isValid() const;
132  QObject *object() const;
133  Role role(int child) const;
134  State state(int child) const;
135 
136  int childCount() const;
137  int indexOfChild(const QAccessibleInterface *) const;
138  QList<QModelIndex> children() const;
139 
140  Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
141  int childAt(int x, int y) const;
142  int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
143 
144  int userActionCount(int child) const;
145  QString actionText(int action, Text t, int child) const;
146  bool doAction(int action, int child, const QVariantList &params = QVariantList());
147 
148  QModelIndex childIndex(int child) const;
149 
150  QHeaderView *horizontalHeader() const; //used by QAccessibleItemView
151 private:
152  static QAbstractItemView::CursorAction toCursorAction(Relation rel);
153  int logicalFromChild(QHeaderView *header, int child) const;
154  int treeLevel() const;
155  QHeaderView *verticalHeader() const;
156  QString text_helper(int child) const;
157 
160  bool m_header;
161 };
162 
164 {
166 public:
167  explicit QAccessibleItemView(QWidget *w);
168 
169  QObject *object() const;
170  Role role(int child) const;
171  State state(int child) const;
172  QRect rect(int child) const;
173  int childAt(int x, int y) const;
174  int childCount() const;
175  QString text(Text t, int child) const;
176  void setText(Text t, int child, const QString &text);
177  int indexOfChild(const QAccessibleInterface *iface) const;
178 
179  QModelIndex childIndex(int child) const;
180  int entryFromIndex(const QModelIndex &index) const;
181  bool isValid() const;
182  int navigate(RelationFlag relation, int index, QAccessibleInterface **iface) const;
183 
184  QAccessibleInterface *accessibleAt(int row, int column);
185  QAccessibleInterface *caption();
186  int childIndex(int rowIndex, int columnIndex);
187  QString columnDescription(int column);
188  int columnSpan(int row, int column);
189  QAccessibleInterface *columnHeader();
190  int columnIndex(int childIndex);
191  int columnCount();
192  int rowCount();
193  int selectedColumnCount();
194  int selectedRowCount();
195  QString rowDescription(int row);
196  int rowSpan(int row, int column);
197  QAccessibleInterface *rowHeader();
198  int rowIndex(int childIndex);
199  int selectedRows(int maxRows, QList<int> *rows);
200  int selectedColumns(int maxColumns, QList<int> *columns);
201  QAccessibleInterface *summary();
202  bool isColumnSelected(int column);
203  bool isRowSelected(int row);
204  bool isSelected(int row, int column);
205  void selectRow(int row);
206  void selectColumn(int column);
207  void unselectRow(int row);
208  void unselectColumn(int column);
209  void cellAtIndex(int index, int *row, int *column, int *rowSpan,
210  int *columnSpan, bool *isSelected);
211 
212  QHeaderView *horizontalHeader() const;
213  QHeaderView *verticalHeader() const;
214  bool isValidChildRole(QAccessible::Role role) const;
215 
216 protected:
217  QAbstractItemView *itemView() const;
218  QModelIndex index(int row, int column) const;
219 
220 private:
221  inline bool atViewport() const {
222  return atVP;
223  };
224  QAccessible::Role expectedRoleOfChildren() const;
225 
226  bool atVP;
227 };
228 
229 #endif
230 
231 #ifndef QT_NO_TABBAR
233 {
235 public:
236  explicit QAccessibleTabBar(QWidget *w);
237 
238  int childCount() const;
239 
240  QRect rect(int child) const;
241  QString text(Text t, int child) const;
242  Role role(int child) const;
243  State state(int child) const;
244  int navigate(RelationFlag relation, int entry,
245  QAccessibleInterface **target) const;
246 
247  bool doAction(int action, int child, const QVariantList &params);
248  QString actionText(int action, Text t, int child) const;
249  int userActionCount(int child) const;
250  bool setSelected(int child, bool on, bool extend);
251  QVector<int> selection() const;
252 
253 protected:
254  QTabBar *tabBar() const;
255 
256 private:
257  QAbstractButton *button(int child) const;
258 };
259 #endif // QT_NO_TABBAR
260 
261 #ifndef QT_NO_COMBOBOX
263 {
265 public:
266  explicit QAccessibleComboBox(QWidget *w);
267 
269  ComboBoxSelf = 0,
272  PopupList
273  };
274 
275  int childCount() const;
276  int childAt(int x, int y) const;
277  int indexOfChild(const QAccessibleInterface *child) const;
278  int navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const;
279 
280  QString text(Text t, int child) const;
281  QRect rect(int child) const;
282  Role role(int child) const;
283  State state(int child) const;
284 
285  bool doAction(int action, int child, const QVariantList &params);
286  QString actionText(int action, Text t, int child) const;
287 
288 protected:
289  QComboBox *comboBox() const;
290 };
291 #endif // QT_NO_COMBOBOX
292 
293 #endif // QT_NO_ACCESSIBILITY
294 
296 
297 #endif // COMPLEXWIDGETS_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
Role role(int child) const
Returns the role of the object, or of the object&#39;s child if child is not 0.
AbstractScrollAreaElement elementType(QWidget *widget) const
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QAccessibleAbstractScrollArea(QWidget *widget)
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...
Role
This enum defines the role of an accessible object.
Definition: qaccessible.h:188
QWidgetList accessibleChildren() const
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
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...
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
The QTabBar class provides a tab bar, e.g.
Definition: qtabbar.h:59
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
The QScrollArea class provides a scrolling view onto another widget.
Definition: qscrollarea.h:57
The QAccessibleComboBox class implements the QAccessibleInterface for editable and read-only combo bo...
void setText(Text textType, 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 QAccessibleHeader class implements the QAccessibleInterface for header widgets.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
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
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
#define Q_ACCESSIBLE_OBJECT
Definition: qaccessible2.h:108
QPointer< QAbstractItemView > view
The State element defines configurations of objects and properties.
QAbstractScrollArea * abstractScrollArea() const
QString text(Text textType, int child) const
Returns the value of the text property t of the object, or of the object&#39;s child if child is not 0...
The QAbstractItemView class provides the basic functionality for item view classes.
int childAt(int x, int y) const
Returns the 1-based index of the child that contains the screen coordinates (x, y).
QHeaderView * verticalHeader() const
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...
The QPersistentModelIndex class is used to locate data in a data model.
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
QWidget * widget() const
State state(int child) const
Returns the current state of the object, or of the object&#39;s child if child is not 0...
QList< QVariant > QVariantList
Definition: qvariant.h:443
The QModelIndex class is used to locate data in a data model.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
quint16 index
The QAccessibleTabBar class implements the QAccessibleInterface for tab bars.
QVariant invokeMethodEx(QAccessible::Method method, int child, const QVariantList &params)
CursorAction
This enum describes the different ways to navigate between items,.
bool isValid() const
Returns true if all the data necessary to use this interface implementation is valid (e...
int navigate(RelationFlag relation, 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.
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 childCount() const
Returns the number of children that belong to this object.
QHeaderView * horizontalHeader() const
QRect rect(int child) const
Returns the geometry of the object, or of the object&#39;s child if child is not 0.
bool atViewport() const
QPersistentModelIndex row
QModelIndex childIndex(int child) const
The QHeaderView class provides a header row or header column for item views.
Definition: qheaderview.h:58
The Text item allows you to add formatted text to a scene.