qaccessiblewidgetfactory.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/accessible/qaccessiblewidgetfactory.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qaccessiblewidgets_p.h"-
41#include "qaccessiblemenu_p.h"-
42#include "private/qwidget_p.h"-
43#include "simplewidgets_p.h"-
44#include "rangecontrols_p.h"-
45#include "complexwidgets_p.h"-
46#include "itemviews_p.h"-
47-
48#include <qpushbutton.h>-
49#include <qtoolbutton.h>-
50#include <qtreeview.h>-
51#include <qvariant.h>-
52#include <qaccessible.h>-
53-
54#ifndef QT_NO_ACCESSIBILITY-
55-
56QT_BEGIN_NAMESPACE-
57-
58QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object)-
59{-
60 QAccessibleInterface *iface = 0;-
61 if (!object || !object->isWidgetType())-
62 return iface;-
63-
64 QWidget *widget = static_cast<QWidget*>(object);-
65 // QWidget emits destroyed() from its destructor instead of letting the QObject-
66 // destructor do it, which means the QWidget is unregistered from the accessibillity-
67 // cache. But QWidget destruction also emits enter and leave events, which may end-
68 // up here, so we have to ensure that we don't fill the cache with an entry of-
69 // a widget that is going away.-
70 if (QWidgetPrivate::get(widget)->data.in_destructor)-
71 return iface;-
72-
73 if (false) {
dead code: { }
-
74#ifndef QT_NO_LINEEDIT
dead code: { }
-
75 } else if (classname == QLatin1String("QLineEdit")) {
dead code: { }
-
76 if (widget->objectName() == QLatin1String("qt_spinbox_lineedit"))-
77 iface = 0;-
78 else-
79 iface = new QAccessibleLineEdit(widget);-
80#endif-
81#ifndef QT_NO_COMBOBOX-
82 } else if (classname == QLatin1String("QComboBox")) {-
83 iface = new QAccessibleComboBox(widget);-
84#endif-
85#ifndef QT_NO_SPINBOX-
86 } else if (classname == QLatin1String("QAbstractSpinBox")) {-
87 iface = new QAccessibleAbstractSpinBox(widget);-
88 } else if (classname == QLatin1String("QSpinBox")) {-
89 iface = new QAccessibleSpinBox(widget);-
90 } else if (classname == QLatin1String("QDoubleSpinBox")) {-
91 iface = new QAccessibleDoubleSpinBox(widget);-
92#endif-
93#ifndef QT_NO_SCROLLBAR-
94 } else if (classname == QLatin1String("QScrollBar")) {-
95 iface = new QAccessibleScrollBar(widget);-
96#endif-
97 } else if (classname == QLatin1String("QAbstractSlider")) {-
98 iface = new QAccessibleAbstractSlider(widget);-
99#ifndef QT_NO_SLIDER-
100 } else if (classname == QLatin1String("QSlider")) {-
101 iface = new QAccessibleSlider(widget);-
102#endif-
103#ifndef QT_NO_TOOLBUTTON-
104 } else if (classname == QLatin1String("QToolButton")) {-
105 iface = new QAccessibleToolButton(widget);-
106#endif // QT_NO_TOOLBUTTON-
107 } else if (classname == QLatin1String("QCheckBox")-
108 || classname == QLatin1String("QRadioButton")-
109 || classname == QLatin1String("QPushButton")-
110 || classname == QLatin1String("QAbstractButton")) {-
111 iface = new QAccessibleButton(widget);-
112 } else if (classname == QLatin1String("QDialog")) {-
113 iface = new QAccessibleWidget(widget, QAccessible::Dialog);-
114 } else if (classname == QLatin1String("QMessageBox")) {-
115 iface = new QAccessibleWidget(widget, QAccessible::AlertMessage);-
116#ifndef QT_NO_MAINWINDOW-
117 } else if (classname == QLatin1String("QMainWindow")) {-
118 iface = new QAccessibleMainWindow(widget);-
119#endif-
120 } else if (classname == QLatin1String("QLabel") || classname == QLatin1String("QLCDNumber")) {-
121 iface = new QAccessibleDisplay(widget);-
122#ifndef QT_NO_GROUPBOX-
123 } else if (classname == QLatin1String("QGroupBox")) {-
124 iface = new QAccessibleGroupBox(widget);-
125#endif-
126 } else if (classname == QLatin1String("QStatusBar")) {-
127 iface = new QAccessibleDisplay(widget);-
128#ifndef QT_NO_PROGRESSBAR-
129 } else if (classname == QLatin1String("QProgressBar")) {-
130 iface = new QAccessibleProgressBar(widget);-
131#endif-
132 } else if (classname == QLatin1String("QToolBar")) {-
133 iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());-
134#ifndef QT_NO_MENUBAR-
135 } else if (classname == QLatin1String("QMenuBar")) {-
136 iface = new QAccessibleMenuBar(widget);-
137#endif-
138#ifndef QT_NO_MENU-
139 } else if (classname == QLatin1String("QMenu")) {-
140 iface = new QAccessibleMenu(widget);-
141#endif-
142#ifndef QT_NO_ITEMVIEWS-
143 } else if (classname == QLatin1String("QTreeView")) {-
144 iface = new QAccessibleTree(widget);-
145 } else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {-
146 iface = new QAccessibleTable(widget);-
147 // ### This should be cleaned up. We return the parent for the scrollarea to hide it.-
148#endif // QT_NO_ITEMVIEWS-
149#ifndef QT_NO_TABBAR-
150 } else if (classname == QLatin1String("QTabBar")) {-
151 iface = new QAccessibleTabBar(widget);-
152#endif-
153 } else if (classname == QLatin1String("QSizeGrip")) {-
154 iface = new QAccessibleWidget(widget, QAccessible::Grip);-
155#ifndef QT_NO_SPLITTER-
156 } else if (classname == QLatin1String("QSplitter")) {-
157 iface = new QAccessibleWidget(widget, QAccessible::Splitter);-
158 } else if (classname == QLatin1String("QSplitterHandle")) {-
159 iface = new QAccessibleWidget(widget, QAccessible::Grip);-
160#endif-
161#if !defined(QT_NO_TEXTEDIT) && !defined(QT_NO_CURSOR)-
162 } else if (classname == QLatin1String("QTextEdit")) {-
163 iface = new QAccessibleTextEdit(widget);-
164 } else if (classname == QLatin1String("QPlainTextEdit")) {-
165 iface = new QAccessiblePlainTextEdit(widget);-
166#endif-
167 } else if (classname == QLatin1String("QTipLabel")) {-
168 iface = new QAccessibleDisplay(widget, QAccessible::ToolTip);-
169 } else if (classname == QLatin1String("QFrame")) {-
170 iface = new QAccessibleWidget(widget, QAccessible::Border);-
171#ifndef QT_NO_STACKEDWIDGET-
172 } else if (classname == QLatin1String("QStackedWidget")) {-
173 iface = new QAccessibleStackedWidget(widget);-
174#endif-
175#ifndef QT_NO_TOOLBOX-
176 } else if (classname == QLatin1String("QToolBox")) {-
177 iface = new QAccessibleToolBox(widget);-
178#endif-
179#ifndef QT_NO_MDIAREA-
180 } else if (classname == QLatin1String("QMdiArea")) {-
181 iface = new QAccessibleMdiArea(widget);-
182 } else if (classname == QLatin1String("QMdiSubWindow")) {-
183 iface = new QAccessibleMdiSubWindow(widget);-
184#endif-
185 } else if (classname == QLatin1String("QDialogButtonBox")) {-
186 iface = new QAccessibleDialogButtonBox(widget);-
187#ifndef QT_NO_DIAL-
188 } else if (classname == QLatin1String("QDial")) {-
189 iface = new QAccessibleDial(widget);-
190#endif-
191#ifndef QT_NO_RUBBERBAND-
192 } else if (classname == QLatin1String("QRubberBand")) {-
193 iface = new QAccessibleWidget(widget, QAccessible::Border);-
194#endif-
195#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)-
196 } else if (classname == QLatin1String("QTextBrowser")) {-
197 iface = new QAccessibleTextBrowser(widget);-
198#endif-
199#ifndef QT_NO_SCROLLAREA-
200 } else if (classname == QLatin1String("QAbstractScrollArea")) {-
201 iface = new QAccessibleAbstractScrollArea(widget);-
202 } else if (classname == QLatin1String("QScrollArea")) {-
203 iface = new QAccessibleScrollArea(widget);-
204#endif-
205#ifndef QT_NO_CALENDARWIDGET-
206 } else if (classname == QLatin1String("QCalendarWidget")) {-
207 iface = new QAccessibleCalendarWidget(widget);-
208#endif-
209#ifndef QT_NO_DOCKWIDGET-
210 } else if (classname == QLatin1String("QDockWidget")) {-
211 iface = new QAccessibleDockWidget(widget);-
212#endif-
213-
214 } else if (classname == QLatin1String("QDesktopScreenWidget")) {-
215 iface = 0;-
216 } else if (classname == QLatin1String("QWidget")) {-
217 iface = new QAccessibleWidget(widget);-
218 } else if (classname == QLatin1String("QWindowContainer")) {-
219 iface = new QAccessibleWindowContainer(widget);-
220 }-
221-
222 return iface;-
223}-
224-
225QT_END_NAMESPACE-
226-
227#endif // QT_NO_ACCESSIBILITY-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9