| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QACCESSIBLEQUICKWIDGET_H |
| 5 | #define QACCESSIBLEQUICKWIDGET_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qquickwidget.h" |
| 19 | #include <QtWidgets/qaccessiblewidget.h> |
| 20 | |
| 21 | #include <private/qaccessiblequickview_p.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | #if QT_CONFIG(accessibility) |
| 26 | |
| 27 | // These classes implement the QQuickWiget accessibility switcharoo, |
| 28 | // where the child items of the QQuickWidgetOffscreenWindow are reported |
| 29 | // as child accessible interfaces of the QAccessibleQuickWidget. |
| 30 | class QAccessibleQuickWidget: public QAccessibleWidget |
| 31 | { |
| 32 | public: |
| 33 | QAccessibleQuickWidget(QQuickWidget* widget); |
| 34 | ~QAccessibleQuickWidget(); |
| 35 | |
| 36 | QAccessibleInterface *child(int index) const override; |
| 37 | int childCount() const override; |
| 38 | int indexOfChild(const QAccessibleInterface *iface) const override; |
| 39 | QAccessibleInterface *childAt(int x, int y) const override; |
| 40 | |
| 41 | private: |
| 42 | void repairWindow(); |
| 43 | |
| 44 | std::unique_ptr<QAccessibleQuickWindow> m_accessibleWindow; |
| 45 | QMetaObject::Connection m_connection; |
| 46 | Q_DISABLE_COPY(QAccessibleQuickWidget) |
| 47 | }; |
| 48 | |
| 49 | class QAccessibleQuickWidgetOffscreenWindow: public QAccessibleQuickWindow |
| 50 | { |
| 51 | public: |
| 52 | QAccessibleQuickWidgetOffscreenWindow(QQuickWindow *window); |
| 53 | QAccessibleInterface *child(int index) const override; |
| 54 | int childCount() const override; |
| 55 | int indexOfChild(const QAccessibleInterface *iface) const override; |
| 56 | QAccessibleInterface *childAt(int x, int y) const override; |
| 57 | }; |
| 58 | |
| 59 | #endif // accessibility |
| 60 | |
| 61 | QT_END_NAMESPACE |
| 62 | |
| 63 | #endif |
| 64 |
