| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/accessible/qaccessiblewidget.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | static QList<QWidget*> childWidgets(const QWidget *widget) | - | ||||||||||||
| 8 | { | - | ||||||||||||
| 9 | QList<QObject*> list = widget->children(); | - | ||||||||||||
| QList<QWidget*> widgets; | ||||||||||||||
| 10 | for (int i = 0; i < list.size(); ++i)QObject *o : widget->children()) { | - | ||||||||||||
| 11 | QWidget *w = qobject_cast<QWidget *>(list.at(i));o); | - | ||||||||||||
| 12 | if (w
| 0 | ||||||||||||
| 13 | && !qobject_cast<QFocusFrame*>(w)
| 0 | ||||||||||||
| 14 | - | |||||||||||||
| 15 | && !qobject_cast<QMenu*>(w)
| 0 | ||||||||||||
| 16 | - | |||||||||||||
| 17 | && w->objectName() != QLatin1String("qt_rubberband")
| 0 | ||||||||||||
| 18 | && w->objectName() != QLatin1String("qt_spinbox_lineedit")
| 0 | ||||||||||||
| 19 | widgets.append(w); never executed: widgets.append(w); | 0 | ||||||||||||
| 20 | } never executed: end of block | 0 | ||||||||||||
| 21 | return never executed: widgets;return widgets;never executed: return widgets; | 0 | ||||||||||||
| 22 | } | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | static QString buddyString(const QWidget *widget) | - | ||||||||||||
| 25 | { | - | ||||||||||||
| 26 | if (!widget
| 0 | ||||||||||||
| 27 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 28 | QWidget *parent = widget->parentWidget(); | - | ||||||||||||
| 29 | if (!parent
| 0 | ||||||||||||
| 30 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | QObjectList ol =for (QObject *o : parent->children(); | - | ||||||||||||
| for (int i = 0; i < ol.size(); ++i)()) { | ||||||||||||||
| 33 | QLabel *label = qobject_cast<QLabel*>(ol.at(i));o); | - | ||||||||||||
| 34 | if (label
| 0 | ||||||||||||
| 35 | return never executed: label->text();return label->text();never executed: return label->text(); | 0 | ||||||||||||
| 36 | } never executed: end of block | 0 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); | - | ||||||||||||
| 41 | if (groupbox
| 0 | ||||||||||||
| 42 | return never executed: groupbox->title();return groupbox->title();never executed: return groupbox->title(); | 0 | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | - | |||||||||||||
| 51 | static int qt_accAmpIndex(const QString &text) | - | ||||||||||||
| 52 | { | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | if (text.isEmpty()) | - | ||||||||||||
| 55 | return -1; | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | int fa = 0; | - | ||||||||||||
| 58 | while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) { | - | ||||||||||||
| 59 | ++fa; | - | ||||||||||||
| 60 | if (fa < text.length()) { | - | ||||||||||||
| 61 | - | |||||||||||||
| 62 | if (text.at(fa) == QLatin1Char('&')) { | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | ++fa; | - | ||||||||||||
| 65 | continue; | - | ||||||||||||
| 66 | } else { | - | ||||||||||||
| 67 | return fa - 1; | - | ||||||||||||
| 68 | break; dead code: break; | - | ||||||||||||
| 69 | } | - | ||||||||||||
| 70 | } | - | ||||||||||||
| 71 | } | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | return -1; | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | - | |||||||||||||
| 76 | - | |||||||||||||
| 77 | - | |||||||||||||
| 78 | } | - | ||||||||||||
| 79 | - | |||||||||||||
| 80 | QString qt_accStripAmp(const QString &text) | - | ||||||||||||
| 81 | { | - | ||||||||||||
| 82 | QString newText(text); | - | ||||||||||||
| 83 | int ampIndex = qt_accAmpIndex(newText); | - | ||||||||||||
| 84 | if (ampIndex != -1) | - | ||||||||||||
| 85 | newText.remove(ampIndex, 1); | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | return newText.replace(QLatin1String("&&"), QLatin1String("&")); | - | ||||||||||||
| 88 | } | - | ||||||||||||
| 89 | - | |||||||||||||
| 90 | QString qt_accHotKey(const QString &text) | - | ||||||||||||
| 91 | { | - | ||||||||||||
| 92 | int ampIndex = qt_accAmpIndex(text); | - | ||||||||||||
| 93 | if (ampIndex != -1) | - | ||||||||||||
| 94 | return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | return QString(); | - | ||||||||||||
| 97 | } | - | ||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | class QAccessibleWidgetPrivate | - | ||||||||||||
| 101 | { | - | ||||||||||||
| 102 | public: | - | ||||||||||||
| 103 | QAccessibleWidgetPrivate() | - | ||||||||||||
| 104 | :role(QAccessible::Client) | - | ||||||||||||
| 105 | {} | - | ||||||||||||
| 106 | - | |||||||||||||
| 107 | QAccessible::Role role; | - | ||||||||||||
| 108 | QString name; | - | ||||||||||||
| 109 | QStringList primarySignals; | - | ||||||||||||
| 110 | }; | - | ||||||||||||
| 111 | QAccessibleWidget::QAccessibleWidget(QWidget *w, QAccessible::Role role, const QString &name) | - | ||||||||||||
| 112 | : QAccessibleObject(w) | - | ||||||||||||
| 113 | { | - | ||||||||||||
| 114 | ((!(widget())) ? qt_assert("widget()",__FILE__,192196) : qt_noop()); | - | ||||||||||||
| 115 | d = new QAccessibleWidgetPrivate(); | - | ||||||||||||
| 116 | d->role = role; | - | ||||||||||||
| 117 | d->name = name; | - | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | bool QAccessibleWidget::isValid() const | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | if (!object() || static_cast<QWidget *>(object())->d_func()->data.in_destructor) | - | ||||||||||||
| 124 | return false; | - | ||||||||||||
| 125 | return QAccessibleObject::isValid(); | - | ||||||||||||
| 126 | } | - | ||||||||||||
| 127 | - | |||||||||||||
| 128 | - | |||||||||||||
| 129 | QWindow *QAccessibleWidget::window() const | - | ||||||||||||
| 130 | { | - | ||||||||||||
| 131 | const QWidget *w = widget(); | - | ||||||||||||
| 132 | ((!(w)) ? qt_assert("w",__FILE__,210214) : qt_noop()); | - | ||||||||||||
| 133 | QWindow *result = w->windowHandle(); | - | ||||||||||||
| 134 | if (!result) { | - | ||||||||||||
| 135 | if (const QWidget *nativeParent = w->nativeParentWidget()) | - | ||||||||||||
| 136 | result = nativeParent->windowHandle(); | - | ||||||||||||
| 137 | } | - | ||||||||||||
| 138 | return result; | - | ||||||||||||
| 139 | } | - | ||||||||||||
| 140 | - | |||||||||||||
| 141 | - | |||||||||||||
| 142 | - | |||||||||||||
| 143 | - | |||||||||||||
| 144 | QAccessibleWidget::~QAccessibleWidget() | - | ||||||||||||
| 145 | { | - | ||||||||||||
| 146 | delete d; | - | ||||||||||||
| 147 | } | - | ||||||||||||
| 148 | - | |||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | - | |||||||||||||
| 152 | QWidget *QAccessibleWidget::widget() const | - | ||||||||||||
| 153 | { | - | ||||||||||||
| 154 | return qobject_cast<QWidget*>(object()); | - | ||||||||||||
| 155 | } | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | - | |||||||||||||
| 160 | - | |||||||||||||
| 161 | QObject *QAccessibleWidget::parentObject() const | - | ||||||||||||
| 162 | { | - | ||||||||||||
| 163 | QWidget *w = widget(); | - | ||||||||||||
| 164 | if (!w || w->isWindow() || !w->parentWidget()) | - | ||||||||||||
| 165 | return (static_cast<QApplication *>(QCoreApplication::instance())); | - | ||||||||||||
| 166 | return w->parent(); | - | ||||||||||||
| 167 | } | - | ||||||||||||
| 168 | - | |||||||||||||
| 169 | - | |||||||||||||
| 170 | QRect QAccessibleWidget::rect() const | - | ||||||||||||
| 171 | { | - | ||||||||||||
| 172 | QWidget *w = widget(); | - | ||||||||||||
| 173 | if (!w->isVisible()) | - | ||||||||||||
| 174 | return QRect(); | - | ||||||||||||
| 175 | QPoint wpos = w->mapToGlobal(QPoint(0, 0)); | - | ||||||||||||
| 176 | - | |||||||||||||
| 177 | return QRect(wpos.x(), wpos.y(), w->width(), w->height()); | - | ||||||||||||
| 178 | } | - | ||||||||||||
| 179 | - | |||||||||||||
| 180 | - | |||||||||||||
| 181 | - | |||||||||||||
| 182 | - | |||||||||||||
| 183 | class QACConnectionObject : public QObject | - | ||||||||||||
| 184 | { | - | ||||||||||||
| 185 | inline QObjectPrivate* d_func() { return reinterpret_cast<QObjectPrivate *>(qGetPtrHelper(d_ptr)); } inline const QObjectPrivate* d_func() const { return reinterpret_cast<const QObjectPrivate *>(qGetPtrHelper(d_ptr)); } friend class QObjectPrivate; | - | ||||||||||||
| 186 | public: | - | ||||||||||||
| 187 | inline bool isSender(const QObject *receiver, const char *signal) const | - | ||||||||||||
| 188 | { return d_func()->isSender(receiver, signal); } | - | ||||||||||||
| 189 | inline QObjectList receiverList(const char *signal) const | - | ||||||||||||
| 190 | { return d_func()->receiverList(signal); } | - | ||||||||||||
| 191 | inline QObjectList senderList() const | - | ||||||||||||
| 192 | { return d_func()->senderList(); } | - | ||||||||||||
| 193 | }; | - | ||||||||||||
| 194 | - | |||||||||||||
| 195 | - | |||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | - | |||||||||||||
| 201 | void QAccessibleWidget::addControllingSignal(const QString &signal) | - | ||||||||||||
| 202 | { | - | ||||||||||||
| 203 | QByteArray s = QMetaObject::normalizedSignature(signal.toLatin1()); | - | ||||||||||||
| 204 | if (__builtin_expect(!!(
| 0 | ||||||||||||
| 205 | QMessageLogger(__FILE__, 284288, __PRETTY_FUNCTION__).warning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className()); never executed: QMessageLogger(__FILE__, 288, __PRETTY_FUNCTION__).warning("Signal %s unknown in %s", s.constData(), object()->metaObject()->className()); | 0 | ||||||||||||
| 206 | d->primarySignals << QLatin1String(s); | - | ||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||
| 208 | - | |||||||||||||
| 209 | static inline bool isAncestor(const QObject *obj, const QObject *child) | - | ||||||||||||
| 210 | { | - | ||||||||||||
| 211 | while (child) { | - | ||||||||||||
| 212 | if (child == obj) | - | ||||||||||||
| 213 | return true; | - | ||||||||||||
| 214 | child = child->parent(); | - | ||||||||||||
| 215 | } | - | ||||||||||||
| 216 | return false; | - | ||||||||||||
| 217 | } | - | ||||||||||||
| 218 | - | |||||||||||||
| 219 | - | |||||||||||||
| 220 | QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > | - | ||||||||||||
| 221 | QAccessibleWidget::relations(QAccessible::Relation match ) const | - | ||||||||||||
| 222 | { | - | ||||||||||||
| 223 | QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels; | - | ||||||||||||
| 224 | if (match & QAccessible::Label
| 0 | ||||||||||||
| 225 | const QAccessible::Relation rel = QAccessible::Label; | - | ||||||||||||
| 226 | if (QWidget *parent = widget()->parentWidget()
| 0 | ||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | - | |||||||||||||
| 230 | - | |||||||||||||
| 231 | const QList<QWidget*> kids = childWidgets(parent); | - | ||||||||||||
| 232 | for (int i = 0; i <QWidget *kid : kids.count(); ++i) { | - | ||||||||||||
| 233 | if (QLabel *labelSibling = qobject_cast<QLabel*>(kids.at(i)))kid)
| 0 | ||||||||||||
| 234 | if (labelSibling->buddy() == widget()
| 0 | ||||||||||||
| 235 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(labelSibling); | - | ||||||||||||
| 236 | rels.append(qMakePair(iface, rel)); | - | ||||||||||||
| 237 | } never executed: end of block | 0 | ||||||||||||
| 238 | } never executed: end of block | 0 | ||||||||||||
| 239 | } never executed: end of block | 0 | ||||||||||||
| 240 | - | |||||||||||||
| 241 | - | |||||||||||||
| 242 | QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent); | - | ||||||||||||
| 243 | if (groupbox
| 0 | ||||||||||||
| 244 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupbox); | - | ||||||||||||
| 245 | rels.append(qMakePair(iface, rel)); | - | ||||||||||||
| 246 | } never executed: end of block | 0 | ||||||||||||
| 247 | - | |||||||||||||
| 248 | } never executed: end of block | 0 | ||||||||||||
| 249 | } never executed: end of block | 0 | ||||||||||||
| 250 | - | |||||||||||||
| 251 | if (match & QAccessible::Controlled
| 0 | ||||||||||||
| 252 | QObjectList allReceivers; | - | ||||||||||||
| 253 | QACConnectionObject *connectionObject = (QACConnectionObject*)object(); | - | ||||||||||||
| 254 | for (int sig = 0; sig < d->primarySignals.count()
| 0 | ||||||||||||
| 255 | const QObjectList receivers = connectionObject->receiverList(d->primarySignals.at(sig).toLatin1()); | - | ||||||||||||
| 256 | allReceivers += receivers; | - | ||||||||||||
| 257 | } never executed: end of block | 0 | ||||||||||||
| 258 | - | |||||||||||||
| 259 | allReceivers.removeAll(object()); | - | ||||||||||||
| 260 | - | |||||||||||||
| 261 | for (int i = 0; i < allReceivers.count()
| 0 | ||||||||||||
| 262 | const QAccessible::Relation rel = QAccessible::Controlled; | - | ||||||||||||
| 263 | QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(allReceivers.at(i)); | - | ||||||||||||
| 264 | if (iface
| 0 | ||||||||||||
| 265 | rels.append(qMakePair(iface, rel)); never executed: rels.append(qMakePair(iface, rel)); | 0 | ||||||||||||
| 266 | } never executed: end of block | 0 | ||||||||||||
| 267 | } never executed: end of block | 0 | ||||||||||||
| 268 | - | |||||||||||||
| 269 | return never executed: rels;return rels;never executed: return rels; | 0 | ||||||||||||
| 270 | } | - | ||||||||||||
| 271 | - | |||||||||||||
| 272 | - | |||||||||||||
| 273 | QAccessibleInterface *QAccessibleWidget::parent() const | - | ||||||||||||
| 274 | { | - | ||||||||||||
| 275 | return QAccessible::queryAccessibleInterface(parentObject()); | - | ||||||||||||
| 276 | } | - | ||||||||||||
| 277 | - | |||||||||||||
| 278 | - | |||||||||||||
| 279 | QAccessibleInterface *QAccessibleWidget::child(int index) const | - | ||||||||||||
| 280 | { | - | ||||||||||||
| 281 | ((!(widget())) ? qt_assert("widget()",__FILE__,360364) : qt_noop()); | - | ||||||||||||
| 282 | QWidgetList childList = childWidgets(widget()); | - | ||||||||||||
| 283 | if (index >= 0 && index < childList.size()) | - | ||||||||||||
| 284 | return QAccessible::queryAccessibleInterface(childList.at(index)); | - | ||||||||||||
| 285 | return 0; | - | ||||||||||||
| 286 | } | - | ||||||||||||
| 287 | - | |||||||||||||
| 288 | - | |||||||||||||
| 289 | QAccessibleInterface *QAccessibleWidget::focusChild() const | - | ||||||||||||
| 290 | { | - | ||||||||||||
| 291 | if (widget()->hasFocus()) | - | ||||||||||||
| 292 | return QAccessible::queryAccessibleInterface(object()); | - | ||||||||||||
| 293 | - | |||||||||||||
| 294 | QWidget *fw = widget()->focusWidget(); | - | ||||||||||||
| 295 | if (!fw) | - | ||||||||||||
| 296 | return 0; | - | ||||||||||||
| 297 | - | |||||||||||||
| 298 | if (isAncestor(widget(), fw) || fw == widget()) | - | ||||||||||||
| 299 | return QAccessible::queryAccessibleInterface(fw); | - | ||||||||||||
| 300 | return 0; | - | ||||||||||||
| 301 | } | - | ||||||||||||
| 302 | - | |||||||||||||
| 303 | - | |||||||||||||
| 304 | int QAccessibleWidget::childCount() const | - | ||||||||||||
| 305 | { | - | ||||||||||||
| 306 | QWidgetList cl = childWidgets(widget()); | - | ||||||||||||
| 307 | return cl.size(); | - | ||||||||||||
| 308 | } | - | ||||||||||||
| 309 | - | |||||||||||||
| 310 | - | |||||||||||||
| 311 | int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const | - | ||||||||||||
| 312 | { | - | ||||||||||||
| 313 | if (!child) | - | ||||||||||||
| 314 | return -1; | - | ||||||||||||
| 315 | QWidgetList cl = childWidgets(widget()); | - | ||||||||||||
| 316 | return cl.indexOf(qobject_cast<QWidget *>(child->object())); | - | ||||||||||||
| 317 | } | - | ||||||||||||
| 318 | - | |||||||||||||
| 319 | - | |||||||||||||
| 320 | extern QString qt_setWindowTitle_helperHelper(const QString &, const QWidget*); | - | ||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | QString QAccessibleWidget::text(QAccessible::Text t) const | - | ||||||||||||
| 324 | { | - | ||||||||||||
| 325 | QString str; | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | switch (t) { | - | ||||||||||||
| 328 | case QAccessible::Name: | - | ||||||||||||
| 329 | if (!d->name.isEmpty()) { | - | ||||||||||||
| 330 | str = d->name; | - | ||||||||||||
| 331 | } else if (!widget()->accessibleName().isEmpty()) { | - | ||||||||||||
| 332 | str = widget()->accessibleName(); | - | ||||||||||||
| 333 | } else if (widget()->isWindow()) { | - | ||||||||||||
| 334 | if (widget()->isMinimized()) | - | ||||||||||||
| 335 | str = qt_setWindowTitle_helperHelper(widget()->windowIconText(), widget()); | - | ||||||||||||
| 336 | else | - | ||||||||||||
| 337 | str = qt_setWindowTitle_helperHelper(widget()->windowTitle(), widget()); | - | ||||||||||||
| 338 | } else { | - | ||||||||||||
| 339 | str = qt_accStripAmp(buddyString(widget())); | - | ||||||||||||
| 340 | } | - | ||||||||||||
| 341 | break; | - | ||||||||||||
| 342 | case QAccessible::Description: | - | ||||||||||||
| 343 | str = widget()->accessibleDescription(); | - | ||||||||||||
| 344 | - | |||||||||||||
| 345 | if (str.isEmpty()) | - | ||||||||||||
| 346 | str = widget()->toolTip(); | - | ||||||||||||
| 347 | - | |||||||||||||
| 348 | break; | - | ||||||||||||
| 349 | case QAccessible::Help: | - | ||||||||||||
| 350 | - | |||||||||||||
| 351 | str = widget()->whatsThis(); | - | ||||||||||||
| 352 | - | |||||||||||||
| 353 | break; | - | ||||||||||||
| 354 | case QAccessible::Accelerator: | - | ||||||||||||
| 355 | str = qt_accHotKey(buddyString(widget())); | - | ||||||||||||
| 356 | break; | - | ||||||||||||
| 357 | case QAccessible::Value: | - | ||||||||||||
| 358 | break; | - | ||||||||||||
| 359 | default: | - | ||||||||||||
| 360 | break; | - | ||||||||||||
| 361 | } | - | ||||||||||||
| 362 | return str; | - | ||||||||||||
| 363 | } | - | ||||||||||||
| 364 | - | |||||||||||||
| 365 | - | |||||||||||||
| 366 | QStringList QAccessibleWidget::actionNames() const | - | ||||||||||||
| 367 | { | - | ||||||||||||
| 368 | QStringList names; | - | ||||||||||||
| 369 | if (widget()->isEnabled()) { | - | ||||||||||||
| 370 | if (widget()->focusPolicy() != Qt::NoFocus) | - | ||||||||||||
| 371 | names << setFocusAction(); | - | ||||||||||||
| 372 | } | - | ||||||||||||
| 373 | return names; | - | ||||||||||||
| 374 | } | - | ||||||||||||
| 375 | - | |||||||||||||
| 376 | - | |||||||||||||
| 377 | void QAccessibleWidget::doAction(const QString &actionName) | - | ||||||||||||
| 378 | { | - | ||||||||||||
| 379 | if (!widget()->isEnabled()) | - | ||||||||||||
| 380 | return; | - | ||||||||||||
| 381 | - | |||||||||||||
| 382 | if (actionName == setFocusAction()) { | - | ||||||||||||
| 383 | if (widget()->isWindow()) | - | ||||||||||||
| 384 | widget()->activateWindow(); | - | ||||||||||||
| 385 | widget()->setFocus(); | - | ||||||||||||
| 386 | } | - | ||||||||||||
| 387 | } | - | ||||||||||||
| 388 | - | |||||||||||||
| 389 | - | |||||||||||||
| 390 | QStringList QAccessibleWidget::keyBindingsForAction(const QString & ) const | - | ||||||||||||
| 391 | { | - | ||||||||||||
| 392 | return QStringList(); | - | ||||||||||||
| 393 | } | - | ||||||||||||
| 394 | - | |||||||||||||
| 395 | - | |||||||||||||
| 396 | QAccessible::Role QAccessibleWidget::role() const | - | ||||||||||||
| 397 | { | - | ||||||||||||
| 398 | return d->role; | - | ||||||||||||
| 399 | } | - | ||||||||||||
| 400 | - | |||||||||||||
| 401 | - | |||||||||||||
| 402 | QAccessible::State QAccessibleWidget::state() const | - | ||||||||||||
| 403 | { | - | ||||||||||||
| 404 | QAccessible::State state; | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | QWidget *w = widget(); | - | ||||||||||||
| 407 | if (w->testAttribute(Qt::WA_WState_Visible) == false) | - | ||||||||||||
| 408 | state.invisible = true; | - | ||||||||||||
| 409 | if (w->focusPolicy() != Qt::NoFocus) | - | ||||||||||||
| 410 | state.focusable = true; | - | ||||||||||||
| 411 | if (w->hasFocus()) | - | ||||||||||||
| 412 | state.focused = true; | - | ||||||||||||
| 413 | if (!w->isEnabled()) | - | ||||||||||||
| 414 | state.disabled = true; | - | ||||||||||||
| 415 | if (w->isWindow()) { | - | ||||||||||||
| 416 | if (w->windowFlags() & Qt::WindowSystemMenuHint) | - | ||||||||||||
| 417 | state.movable = true; | - | ||||||||||||
| 418 | if (w->minimumSize() != w->maximumSize()) | - | ||||||||||||
| 419 | state.sizeable = true; | - | ||||||||||||
| 420 | if (w->isActiveWindow()) | - | ||||||||||||
| 421 | state.active = true; | - | ||||||||||||
| 422 | } | - | ||||||||||||
| 423 | - | |||||||||||||
| 424 | return state; | - | ||||||||||||
| 425 | } | - | ||||||||||||
| 426 | - | |||||||||||||
| 427 | - | |||||||||||||
| 428 | QColor QAccessibleWidget::foregroundColor() const | - | ||||||||||||
| 429 | { | - | ||||||||||||
| 430 | return widget()->palette().color(widget()->foregroundRole()); | - | ||||||||||||
| 431 | } | - | ||||||||||||
| 432 | - | |||||||||||||
| 433 | - | |||||||||||||
| 434 | QColor QAccessibleWidget::backgroundColor() const | - | ||||||||||||
| 435 | { | - | ||||||||||||
| 436 | return widget()->palette().color(widget()->backgroundRole()); | - | ||||||||||||
| 437 | } | - | ||||||||||||
| 438 | - | |||||||||||||
| 439 | - | |||||||||||||
| 440 | void *QAccessibleWidget::interface_cast(QAccessible::InterfaceType t) | - | ||||||||||||
| 441 | { | - | ||||||||||||
| 442 | if (t == QAccessible::ActionInterface) | - | ||||||||||||
| 443 | return static_cast<QAccessibleActionInterface*>(this); | - | ||||||||||||
| 444 | return 0; | - | ||||||||||||
| 445 | } | - | ||||||||||||
| 446 | - | |||||||||||||
| 447 | - | |||||||||||||
| Switch to Source code | Preprocessed file |