|
|
faff1df |
From 3f7ac5540c8796ec2bb2b595ca6648035a0f8b18 Mon Sep 17 00:00:00 2001
|
|
|
faff1df |
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
|
|
|
faff1df |
Date: Fri, 7 May 2021 10:07:50 +0200
|
|
|
faff1df |
Subject: [PATCH 09/19] Implement accessibility for QQuickWidget
|
|
|
faff1df |
MIME-Version: 1.0
|
|
|
faff1df |
Content-Type: text/plain; charset=UTF-8
|
|
|
faff1df |
Content-Transfer-Encoding: 8bit
|
|
|
faff1df |
|
|
|
faff1df |
The accessibility tree for the Qt Quick content should
|
|
|
faff1df |
be rooted at the QQuickWidget, and not at the offscreen
|
|
|
faff1df |
QQuickWindow.
|
|
|
faff1df |
|
|
|
faff1df |
For this to be the case, several things must happen:
|
|
|
faff1df |
- QQuickWindow must not report the child interfaces
|
|
|
faff1df |
- QQuickWidget must report the child interfaces
|
|
|
faff1df |
- The child interfaces must report the QQuickWidget as the parent
|
|
|
faff1df |
|
|
|
faff1df |
Create accessibility interfaces for QQuickWidget and
|
|
|
faff1df |
and QQuickWigetOffscreenWindow (which now gets a proper
|
|
|
faff1df |
subclass), where the QQuickWidget interface reports
|
|
|
faff1df |
the child interfaces and the QQuickWigetOffscreenWindow
|
|
|
faff1df |
reports no children
|
|
|
faff1df |
|
|
|
faff1df |
Change the code in QAccessibleQuickItem to use the
|
|
|
faff1df |
true (visible) window, where needed.
|
|
|
faff1df |
|
|
|
faff1df |
Fixes: QTBUG-67290
|
|
|
faff1df |
Change-Id: I387d0ef711138d248a8dd16eefc9839499b35eeb
|
|
|
faff1df |
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
|
|
|
faff1df |
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
|
|
faff1df |
(cherry picked from commit 41926e08d73ea6c4bbfc87a1dd52d2cdbc435c27)
|
|
|
faff1df |
---
|
|
|
faff1df |
src/quick/accessible/qaccessiblequickitem.cpp | 29 +++--
|
|
|
faff1df |
src/quick/accessible/qaccessiblequickview_p.h | 2 +-
|
|
|
faff1df |
src/quickwidgets/qaccessiblequickwidget.cpp | 110 ++++++++++++++++++
|
|
|
faff1df |
src/quickwidgets/qaccessiblequickwidget.h | 84 +++++++++++++
|
|
|
faff1df |
.../qaccessiblequickwidgetfactory.cpp | 60 ++++++++++
|
|
|
faff1df |
.../qaccessiblequickwidgetfactory_p.h | 66 +++++++++++
|
|
|
faff1df |
src/quickwidgets/qquickwidget.cpp | 18 ++-
|
|
|
faff1df |
src/quickwidgets/qquickwidget_p.h | 8 ++
|
|
|
faff1df |
src/quickwidgets/quickwidgets.pro | 8 +-
|
|
|
faff1df |
9 files changed, 368 insertions(+), 17 deletions(-)
|
|
|
faff1df |
create mode 100644 src/quickwidgets/qaccessiblequickwidget.cpp
|
|
|
faff1df |
create mode 100644 src/quickwidgets/qaccessiblequickwidget.h
|
|
|
faff1df |
create mode 100644 src/quickwidgets/qaccessiblequickwidgetfactory.cpp
|
|
|
faff1df |
create mode 100644 src/quickwidgets/qaccessiblequickwidgetfactory_p.h
|
|
|
faff1df |
|
|
|
faff1df |
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
|
|
|
faff1df |
index ae1954ae8d..0692ce634d 100644
|
|
|
faff1df |
--- a/src/quick/accessible/qaccessiblequickitem.cpp
|
|
|
faff1df |
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
|
|
|
faff1df |
@@ -46,6 +46,7 @@
|
|
|
faff1df |
#include "QtQuick/private/qquicktextinput_p.h"
|
|
|
faff1df |
#include "QtQuick/private/qquickaccessibleattached_p.h"
|
|
|
faff1df |
#include "QtQuick/qquicktextdocument.h"
|
|
|
faff1df |
+#include "QtQuick/qquickrendercontrol.h"
|
|
|
faff1df |
QT_BEGIN_NAMESPACE
|
|
|
faff1df |
|
|
|
faff1df |
#if QT_CONFIG(accessibility)
|
|
|
faff1df |
@@ -57,7 +58,19 @@ QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
|
|
|
faff1df |
|
|
|
faff1df |
QWindow *QAccessibleQuickItem::window() const
|
|
|
faff1df |
{
|
|
|
faff1df |
- return item()->window();
|
|
|
faff1df |
+ QQuickWindow *window = item()->window();
|
|
|
faff1df |
+
|
|
|
faff1df |
+ // For QQuickWidget the above window will be the offscreen QQuickWindow,
|
|
|
faff1df |
+ // which is not a part of the accessibility tree. Detect this case and
|
|
|
faff1df |
+ // return the window for the QQuickWidget instead.
|
|
|
faff1df |
+ if (window && !window->handle()) {
|
|
|
faff1df |
+ if (QQuickRenderControl *renderControl = QQuickWindowPrivate::get(window)->renderControl) {
|
|
|
faff1df |
+ if (QWindow *renderWindow = renderControl->renderWindow(nullptr))
|
|
|
faff1df |
+ return renderWindow;
|
|
|
faff1df |
+ }
|
|
|
faff1df |
+ }
|
|
|
faff1df |
+
|
|
|
faff1df |
+ return window;
|
|
|
faff1df |
}
|
|
|
faff1df |
|
|
|
faff1df |
int QAccessibleQuickItem::childCount() const
|
|
|
faff1df |
@@ -113,19 +126,15 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const
|
|
|
faff1df |
QAccessibleInterface *QAccessibleQuickItem::parent() const
|
|
|
faff1df |
{
|
|
|
faff1df |
QQuickItem *parent = item()->parentItem();
|
|
|
faff1df |
- QQuickWindow *window = item()->window();
|
|
|
faff1df |
- QQuickItem *ci = window ? window->contentItem() : nullptr;
|
|
|
faff1df |
+ QQuickWindow *itemWindow = item()->window();
|
|
|
faff1df |
+ QQuickItem *ci = itemWindow ? itemWindow->contentItem() : nullptr;
|
|
|
faff1df |
while (parent && !QQuickItemPrivate::get(parent)->isAccessible && parent != ci)
|
|
|
faff1df |
parent = parent->parentItem();
|
|
|
faff1df |
|
|
|
faff1df |
if (parent) {
|
|
|
faff1df |
if (parent == ci) {
|
|
|
faff1df |
- // Jump out to the scene widget if the parent is the root item.
|
|
|
faff1df |
- // There are two root items, QQuickWindow::rootItem and
|
|
|
faff1df |
- // QQuickView::declarativeRoot. The former is the true root item,
|
|
|
faff1df |
- // but is not a part of the accessibility tree. Check if we hit
|
|
|
faff1df |
- // it here and return an interface for the scene instead.
|
|
|
faff1df |
- return QAccessible::queryAccessibleInterface(window);
|
|
|
faff1df |
+ // Jump out to the window if the parent is the root item
|
|
|
faff1df |
+ return QAccessible::queryAccessibleInterface(window());
|
|
|
faff1df |
} else {
|
|
|
faff1df |
while (parent && !parent->d_func()->isAccessible)
|
|
|
faff1df |
parent = parent->parentItem();
|
|
|
faff1df |
@@ -193,7 +202,7 @@ QAccessible::State QAccessibleQuickItem::state() const
|
|
|
faff1df |
QRect viewRect_ = viewRect();
|
|
|
faff1df |
QRect itemRect = rect();
|
|
|
faff1df |
|
|
|
faff1df |
- if (viewRect_.isNull() || itemRect.isNull() || !item()->window() || !item()->window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
|
|
|
faff1df |
+ if (viewRect_.isNull() || itemRect.isNull() || !window() || !window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
|
|
|
faff1df |
state.invisible = true;
|
|
|
faff1df |
if (!viewRect_.intersects(itemRect))
|
|
|
faff1df |
state.offscreen = true;
|
|
|
faff1df |
diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h
|
|
|
faff1df |
index 39ffcaf39c..8baa01330c 100644
|
|
|
faff1df |
--- a/src/quick/accessible/qaccessiblequickview_p.h
|
|
|
faff1df |
+++ b/src/quick/accessible/qaccessiblequickview_p.h
|
|
|
faff1df |
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
|
|
|
faff1df |
|
|
|
faff1df |
#if QT_CONFIG(accessibility)
|
|
|
faff1df |
|
|
|
faff1df |
-class QAccessibleQuickWindow : public QAccessibleObject
|
|
|
faff1df |
+class Q_QUICK_EXPORT QAccessibleQuickWindow : public QAccessibleObject
|
|
|
faff1df |
{
|
|
|
faff1df |
public:
|
|
|
faff1df |
QAccessibleQuickWindow(QQuickWindow *object);
|
|
|
faff1df |
diff --git a/src/quickwidgets/qaccessiblequickwidget.cpp b/src/quickwidgets/qaccessiblequickwidget.cpp
|
|
|
faff1df |
new file mode 100644
|
|
|
faff1df |
index 0000000000..6f04d6693f
|
|
|
faff1df |
--- /dev/null
|
|
|
faff1df |
+++ b/src/quickwidgets/qaccessiblequickwidget.cpp
|
|
|
faff1df |
@@ -0,0 +1,110 @@
|
|
|
faff1df |
+/****************************************************************************
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
|
faff1df |
+** Contact: https://www.qt.io/licensing/
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
faff1df |
+** Commercial License Usage
|
|
|
faff1df |
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
faff1df |
+** accordance with the commercial license agreement provided with the
|
|
|
faff1df |
+** Software or, alternatively, in accordance with the terms contained in
|
|
|
faff1df |
+** a written agreement between you and The Qt Company. For licensing terms
|
|
|
faff1df |
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
faff1df |
+** information use the contact form at https://www.qt.io/contact-us.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU Lesser General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
faff1df |
+** General Public License version 3 as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
faff1df |
+** packaging of this file. Please review the following information to
|
|
|
faff1df |
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
faff1df |
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU
|
|
|
faff1df |
+** General Public License version 2.0 or (at your option) the GNU General
|
|
|
faff1df |
+** Public license version 3 or any later version approved by the KDE Free
|
|
|
faff1df |
+** Qt Foundation. The licenses are as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
faff1df |
+** included in the packaging of this file. Please review the following
|
|
|
faff1df |
+** information to ensure the GNU General Public License requirements will
|
|
|
faff1df |
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
faff1df |
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_END_LICENSE$
|
|
|
faff1df |
+**
|
|
|
faff1df |
+****************************************************************************/
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include "qaccessiblequickwidget.h"
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include "qquickwidget_p.h"
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_BEGIN_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#if QT_CONFIG(accessibility)
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleQuickWidget::QAccessibleQuickWidget(QQuickWidget* widget)
|
|
|
faff1df |
+: QAccessibleWidget(widget)
|
|
|
faff1df |
+, m_accessibleWindow(QQuickWidgetPrivate::get(widget)->offscreenWindow)
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ // NOTE: m_accessibleWindow is a QAccessibleQuickWindow, and not a
|
|
|
faff1df |
+ // QAccessibleQuickWidgetOffscreenWindow (defined below). This means
|
|
|
faff1df |
+ // it will return the Quick item child interfaces, which is what's needed here
|
|
|
faff1df |
+ // (unlike QAccessibleQuickWidgetOffscreenWindow, which will report 0 children).
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *QAccessibleQuickWidget::child(int index) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ return m_accessibleWindow.child(index);
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+int QAccessibleQuickWidget::childCount() const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ return m_accessibleWindow.childCount();
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+int QAccessibleQuickWidget::indexOfChild(const QAccessibleInterface *iface) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ return m_accessibleWindow.indexOfChild(iface);
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *QAccessibleQuickWidget::childAt(int x, int y) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ return m_accessibleWindow.childAt(x, y);
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleQuickWidgetOffscreenWindow::QAccessibleQuickWidgetOffscreenWindow(QQuickWindow *window)
|
|
|
faff1df |
+:QAccessibleQuickWindow(window)
|
|
|
faff1df |
+{
|
|
|
faff1df |
+
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *QAccessibleQuickWidgetOffscreenWindow::child(int index) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ Q_UNUSED(index);
|
|
|
faff1df |
+ return nullptr;
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+int QAccessibleQuickWidgetOffscreenWindow::childCount() const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ return 0;
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+int QAccessibleQuickWidgetOffscreenWindow::indexOfChild(const QAccessibleInterface *iface) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ Q_UNUSED(iface);
|
|
|
faff1df |
+ return -1;
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *QAccessibleQuickWidgetOffscreenWindow::QAccessibleQuickWidgetOffscreenWindow::childAt(int x, int y) const
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ Q_UNUSED(x);
|
|
|
faff1df |
+ Q_UNUSED(y);
|
|
|
faff1df |
+ return nullptr;
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif // accessibility
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_END_NAMESPACE
|
|
|
faff1df |
diff --git a/src/quickwidgets/qaccessiblequickwidget.h b/src/quickwidgets/qaccessiblequickwidget.h
|
|
|
faff1df |
new file mode 100644
|
|
|
faff1df |
index 0000000000..1f52c78c46
|
|
|
faff1df |
--- /dev/null
|
|
|
faff1df |
+++ b/src/quickwidgets/qaccessiblequickwidget.h
|
|
|
faff1df |
@@ -0,0 +1,84 @@
|
|
|
faff1df |
+/****************************************************************************
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
|
faff1df |
+** Contact: https://www.qt.io/licensing/
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
faff1df |
+** Commercial License Usage
|
|
|
faff1df |
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
faff1df |
+** accordance with the commercial license agreement provided with the
|
|
|
faff1df |
+** Software or, alternatively, in accordance with the terms contained in
|
|
|
faff1df |
+** a written agreement between you and The Qt Company. For licensing terms
|
|
|
faff1df |
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
faff1df |
+** information use the contact form at https://www.qt.io/contact-us.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU Lesser General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
faff1df |
+** General Public License version 3 as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
faff1df |
+** packaging of this file. Please review the following information to
|
|
|
faff1df |
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
faff1df |
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU
|
|
|
faff1df |
+** General Public License version 2.0 or (at your option) the GNU General
|
|
|
faff1df |
+** Public license version 3 or any later version approved by the KDE Free
|
|
|
faff1df |
+** Qt Foundation. The licenses are as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
faff1df |
+** included in the packaging of this file. Please review the following
|
|
|
faff1df |
+** information to ensure the GNU General Public License requirements will
|
|
|
faff1df |
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
faff1df |
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_END_LICENSE$
|
|
|
faff1df |
+**
|
|
|
faff1df |
+****************************************************************************/
|
|
|
faff1df |
+
|
|
|
faff1df |
+#ifndef QACCESSIBLEQUICKWIDGET_H
|
|
|
faff1df |
+#define QACCESSIBLEQUICKWIDGET_H
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include "qquickwidget.h"
|
|
|
faff1df |
+#include <QtWidgets/qaccessiblewidget.h>
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include <private/qaccessiblequickview_p.h>
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_BEGIN_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#if QT_CONFIG(accessibility)
|
|
|
faff1df |
+
|
|
|
faff1df |
+// These classes implement the QQuickWiget accessibility switcharoo,
|
|
|
faff1df |
+// where the child items of the QQuickWidgetOffscreenWindow are reported
|
|
|
faff1df |
+// as child accessible interfaces of the QAccessibleQuickWidget.
|
|
|
faff1df |
+class QAccessibleQuickWidget: public QAccessibleWidget
|
|
|
faff1df |
+{
|
|
|
faff1df |
+public:
|
|
|
faff1df |
+ QAccessibleQuickWidget(QQuickWidget* widget);
|
|
|
faff1df |
+
|
|
|
faff1df |
+ QAccessibleInterface *child(int index) const override;
|
|
|
faff1df |
+ int childCount() const override;
|
|
|
faff1df |
+ int indexOfChild(const QAccessibleInterface *iface) const override;
|
|
|
faff1df |
+ QAccessibleInterface *childAt(int x, int y) const override;
|
|
|
faff1df |
+
|
|
|
faff1df |
+private:
|
|
|
faff1df |
+ QAccessibleQuickWindow m_accessibleWindow;
|
|
|
faff1df |
+ Q_DISABLE_COPY(QAccessibleQuickWidget)
|
|
|
faff1df |
+};
|
|
|
faff1df |
+
|
|
|
faff1df |
+class QAccessibleQuickWidgetOffscreenWindow: public QAccessibleQuickWindow
|
|
|
faff1df |
+{
|
|
|
faff1df |
+public:
|
|
|
faff1df |
+ QAccessibleQuickWidgetOffscreenWindow(QQuickWindow *window);
|
|
|
faff1df |
+ QAccessibleInterface *child(int index) const override;
|
|
|
faff1df |
+ int childCount() const override;
|
|
|
faff1df |
+ int indexOfChild(const QAccessibleInterface *iface) const override;
|
|
|
faff1df |
+ QAccessibleInterface *childAt(int x, int y) const override;
|
|
|
faff1df |
+};
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif // accessibility
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_END_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif
|
|
|
faff1df |
diff --git a/src/quickwidgets/qaccessiblequickwidgetfactory.cpp b/src/quickwidgets/qaccessiblequickwidgetfactory.cpp
|
|
|
faff1df |
new file mode 100644
|
|
|
faff1df |
index 0000000000..3756d0c27c
|
|
|
faff1df |
--- /dev/null
|
|
|
faff1df |
+++ b/src/quickwidgets/qaccessiblequickwidgetfactory.cpp
|
|
|
faff1df |
@@ -0,0 +1,60 @@
|
|
|
faff1df |
+/****************************************************************************
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
|
faff1df |
+** Contact: https://www.qt.io/licensing/
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
faff1df |
+** Commercial License Usage
|
|
|
faff1df |
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
faff1df |
+** accordance with the commercial license agreement provided with the
|
|
|
faff1df |
+** Software or, alternatively, in accordance with the terms contained in
|
|
|
faff1df |
+** a written agreement between you and The Qt Company. For licensing terms
|
|
|
faff1df |
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
faff1df |
+** information use the contact form at https://www.qt.io/contact-us.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU Lesser General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
faff1df |
+** General Public License version 3 as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
faff1df |
+** packaging of this file. Please review the following information to
|
|
|
faff1df |
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
faff1df |
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU
|
|
|
faff1df |
+** General Public License version 2.0 or (at your option) the GNU General
|
|
|
faff1df |
+** Public license version 3 or any later version approved by the KDE Free
|
|
|
faff1df |
+** Qt Foundation. The licenses are as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
faff1df |
+** included in the packaging of this file. Please review the following
|
|
|
faff1df |
+** information to ensure the GNU General Public License requirements will
|
|
|
faff1df |
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
faff1df |
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_END_LICENSE$
|
|
|
faff1df |
+**
|
|
|
faff1df |
+****************************************************************************/
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include "qaccessiblequickwidgetfactory_p.h"
|
|
|
faff1df |
+#include "qaccessiblequickwidget.h"
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_BEGIN_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#if QT_CONFIG(accessibility)
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *qAccessibleQuickWidgetFactory(const QString &classname, QObject *object)
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ if (classname == QLatin1String("QQuickWidget")) {
|
|
|
faff1df |
+ return new QAccessibleQuickWidget(qobject_cast<QQuickWidget *>(object));
|
|
|
faff1df |
+ } else if (classname == QLatin1String("QQuickWidgetOffscreenWindow")) {
|
|
|
faff1df |
+ return new QAccessibleQuickWidgetOffscreenWindow(qobject_cast<QQuickWindow *>(object));
|
|
|
faff1df |
+ }
|
|
|
faff1df |
+ return 0;
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif // accessibility
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_END_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
diff --git a/src/quickwidgets/qaccessiblequickwidgetfactory_p.h b/src/quickwidgets/qaccessiblequickwidgetfactory_p.h
|
|
|
faff1df |
new file mode 100644
|
|
|
faff1df |
index 0000000000..8c63b09f81
|
|
|
faff1df |
--- /dev/null
|
|
|
faff1df |
+++ b/src/quickwidgets/qaccessiblequickwidgetfactory_p.h
|
|
|
faff1df |
@@ -0,0 +1,66 @@
|
|
|
faff1df |
+/****************************************************************************
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** Copyright (C) 2021 The Qt Company Ltd.
|
|
|
faff1df |
+** Contact: https://www.qt.io/licensing/
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** This file is part of the QtQuick module of the Qt Toolkit.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
faff1df |
+** Commercial License Usage
|
|
|
faff1df |
+** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
faff1df |
+** accordance with the commercial license agreement provided with the
|
|
|
faff1df |
+** Software or, alternatively, in accordance with the terms contained in
|
|
|
faff1df |
+** a written agreement between you and The Qt Company. For licensing terms
|
|
|
faff1df |
+** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
faff1df |
+** information use the contact form at https://www.qt.io/contact-us.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU Lesser General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
faff1df |
+** General Public License version 3 as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
faff1df |
+** packaging of this file. Please review the following information to
|
|
|
faff1df |
+** ensure the GNU Lesser General Public License version 3 requirements
|
|
|
faff1df |
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** GNU General Public License Usage
|
|
|
faff1df |
+** Alternatively, this file may be used under the terms of the GNU
|
|
|
faff1df |
+** General Public License version 2.0 or (at your option) the GNU General
|
|
|
faff1df |
+** Public license version 3 or any later version approved by the KDE Free
|
|
|
faff1df |
+** Qt Foundation. The licenses are as published by the Free Software
|
|
|
faff1df |
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
faff1df |
+** included in the packaging of this file. Please review the following
|
|
|
faff1df |
+** information to ensure the GNU General Public License requirements will
|
|
|
faff1df |
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
faff1df |
+** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
faff1df |
+**
|
|
|
faff1df |
+** $QT_END_LICENSE$
|
|
|
faff1df |
+**
|
|
|
faff1df |
+****************************************************************************/
|
|
|
faff1df |
+
|
|
|
faff1df |
+#include <QtGui/qaccessible.h>
|
|
|
faff1df |
+
|
|
|
faff1df |
+#ifndef QACCESSIBLEQUICKWIDGETFACTORY_H
|
|
|
faff1df |
+#define QACCESSIBLEQUICKWIDGETFACTORY_H
|
|
|
faff1df |
+
|
|
|
faff1df |
+//
|
|
|
faff1df |
+// W A R N I N G
|
|
|
faff1df |
+// -------------
|
|
|
faff1df |
+//
|
|
|
faff1df |
+// This file is not part of the Qt API. It exists purely as an
|
|
|
faff1df |
+// implementation detail. This header file may change from version to
|
|
|
faff1df |
+// version without notice, or even be removed.
|
|
|
faff1df |
+//
|
|
|
faff1df |
+// We mean it.
|
|
|
faff1df |
+//
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_BEGIN_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#if QT_CONFIG(accessibility)
|
|
|
faff1df |
+
|
|
|
faff1df |
+QAccessibleInterface *qAccessibleQuickWidgetFactory(const QString &classname, QObject *object);
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif
|
|
|
faff1df |
+
|
|
|
faff1df |
+QT_END_NAMESPACE
|
|
|
faff1df |
+
|
|
|
faff1df |
+#endif
|
|
|
faff1df |
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
|
|
|
faff1df |
index 223d91f579..9c97b43518 100644
|
|
|
faff1df |
--- a/src/quickwidgets/qquickwidget.cpp
|
|
|
faff1df |
+++ b/src/quickwidgets/qquickwidget.cpp
|
|
|
faff1df |
@@ -39,6 +39,7 @@
|
|
|
faff1df |
|
|
|
faff1df |
#include "qquickwidget.h"
|
|
|
faff1df |
#include "qquickwidget_p.h"
|
|
|
faff1df |
+#include "qaccessiblequickwidgetfactory_p.h"
|
|
|
faff1df |
|
|
|
faff1df |
#include "private/qquickwindow_p.h"
|
|
|
faff1df |
#include "private/qquickitem_p.h"
|
|
|
faff1df |
@@ -75,9 +76,16 @@
|
|
|
faff1df |
|
|
|
faff1df |
QT_BEGIN_NAMESPACE
|
|
|
faff1df |
|
|
|
faff1df |
+QQuickWidgetOffscreenWindow::QQuickWidgetOffscreenWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control)
|
|
|
faff1df |
+:QQuickWindow(dd, control)
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ setTitle(QString::fromLatin1("Offscreen"));
|
|
|
faff1df |
+ setObjectName(QString::fromLatin1("QQuickOffScreenWindow"));
|
|
|
faff1df |
+}
|
|
|
faff1df |
+
|
|
|
faff1df |
// override setVisble to prevent accidental offscreen window being created
|
|
|
faff1df |
// by base class.
|
|
|
faff1df |
-class QQuickOffcreenWindowPrivate: public QQuickWindowPrivate {
|
|
|
faff1df |
+class QQuickWidgetOffscreenWindowPrivate: public QQuickWindowPrivate {
|
|
|
faff1df |
public:
|
|
|
faff1df |
void setVisible(bool visible) override {
|
|
|
faff1df |
Q_Q(QWindow);
|
|
|
faff1df |
@@ -105,10 +113,8 @@ void QQuickWidgetPrivate::init(QQmlEngine* e)
|
|
|
faff1df |
Q_Q(QQuickWidget);
|
|
|
faff1df |
|
|
|
faff1df |
renderControl = new QQuickWidgetRenderControl(q);
|
|
|
faff1df |
- offscreenWindow = new QQuickWindow(*new QQuickOffcreenWindowPrivate(),renderControl);
|
|
|
faff1df |
+ offscreenWindow = new QQuickWidgetOffscreenWindow(*new QQuickWidgetOffscreenWindowPrivate(), renderControl);
|
|
|
faff1df |
offscreenWindow->setScreen(q->screen());
|
|
|
faff1df |
- offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));
|
|
|
faff1df |
- offscreenWindow->setObjectName(QString::fromLatin1("QQuickOffScreenWindow"));
|
|
|
faff1df |
// Do not call create() on offscreenWindow.
|
|
|
faff1df |
|
|
|
faff1df |
// Check if the Software Adaptation is being used
|
|
|
faff1df |
@@ -139,6 +145,10 @@ void QQuickWidgetPrivate::init(QQmlEngine* e)
|
|
|
faff1df |
QWidget::connect(offscreenWindow, &QQuickWindow::focusObjectChanged, q, &QQuickWidget::propagateFocusObjectChanged);
|
|
|
faff1df |
QObject::connect(renderControl, SIGNAL(renderRequested()), q, SLOT(triggerUpdate()));
|
|
|
faff1df |
QObject::connect(renderControl, SIGNAL(sceneChanged()), q, SLOT(triggerUpdate()));
|
|
|
faff1df |
+
|
|
|
faff1df |
+#if QT_CONFIG(accessibility)
|
|
|
faff1df |
+ QAccessible::installFactory(&qAccessibleQuickWidgetFactory);
|
|
|
faff1df |
+#endif
|
|
|
faff1df |
}
|
|
|
faff1df |
|
|
|
faff1df |
void QQuickWidgetPrivate::ensureEngine() const
|
|
|
faff1df |
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
|
|
|
faff1df |
index 881f7f9220..1a946bcc71 100644
|
|
|
faff1df |
--- a/src/quickwidgets/qquickwidget_p.h
|
|
|
faff1df |
+++ b/src/quickwidgets/qquickwidget_p.h
|
|
|
faff1df |
@@ -148,6 +148,14 @@ public:
|
|
|
faff1df |
bool forceFullUpdate;
|
|
|
faff1df |
};
|
|
|
faff1df |
|
|
|
faff1df |
+class QQuickWidgetOffscreenWindow: public QQuickWindow
|
|
|
faff1df |
+{
|
|
|
faff1df |
+ Q_OBJECT
|
|
|
faff1df |
+
|
|
|
faff1df |
+public:
|
|
|
faff1df |
+ QQuickWidgetOffscreenWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control);
|
|
|
faff1df |
+};
|
|
|
faff1df |
+
|
|
|
faff1df |
QT_END_NAMESPACE
|
|
|
faff1df |
|
|
|
faff1df |
#endif // QQuickWidget_P_H
|
|
|
faff1df |
diff --git a/src/quickwidgets/quickwidgets.pro b/src/quickwidgets/quickwidgets.pro
|
|
|
faff1df |
index 2438e577ae..f46deb54ac 100644
|
|
|
faff1df |
--- a/src/quickwidgets/quickwidgets.pro
|
|
|
faff1df |
+++ b/src/quickwidgets/quickwidgets.pro
|
|
|
faff1df |
@@ -7,9 +7,13 @@ DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES QT_NO_FO
|
|
|
faff1df |
HEADERS += \
|
|
|
faff1df |
qquickwidget.h \
|
|
|
faff1df |
qquickwidget_p.h \
|
|
|
faff1df |
- qtquickwidgetsglobal.h
|
|
|
faff1df |
+ qtquickwidgetsglobal.h \
|
|
|
faff1df |
+ qaccessiblequickwidget.h \
|
|
|
faff1df |
+ qaccessiblequickwidgetfactory_p.h
|
|
|
faff1df |
|
|
|
faff1df |
SOURCES += \
|
|
|
faff1df |
- qquickwidget.cpp
|
|
|
faff1df |
+ qquickwidget.cpp \
|
|
|
faff1df |
+ qaccessiblequickwidget.cpp \
|
|
|
faff1df |
+ qaccessiblequickwidgetfactory.cpp
|
|
|
faff1df |
|
|
|
faff1df |
load(qt_module)
|
|
|
faff1df |
--
|
|
|
faff1df |
2.40.0
|
|
|
faff1df |
|