summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBalazs Egedi <egedib@inf.u-szeged.hu>2021-09-20 13:50:50 +0200
committerBalazs Egedi <egedib@inf.u-szeged.hu>2021-10-26 21:14:15 +0200
commit79f5f290c1eead991e4267a431de9b519abd9834 (patch)
treecb2c119e6a97c5bdca625ca07cc8cef378933dd9 /src
parent974bc6b7d7110df50d6cc46e7eaea12742b9ff66 (diff)
Add onTouchSelectionMenuRequested QML handler
Task-number: QTBUG-85043 Change-Id: Iecd2f5ae20fcf031937a1d44cc154f2e2a3ff52f Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/touch_selection_menu_controller.cpp29
-rw-r--r--src/core/touch_selection_menu_controller.h13
-rw-r--r--src/webenginequick/CMakeLists.txt3
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp140
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h102
-rw-r--r--src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h79
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp11
-rw-r--r--src/webenginequick/api/qquickwebengineview_p.h2
-rw-r--r--src/webenginequick/doc/src/touch_selection_menu_request.qdoc103
9 files changed, 468 insertions, 14 deletions
diff --git a/src/core/touch_selection_menu_controller.cpp b/src/core/touch_selection_menu_controller.cpp
index cdec9a064..3a6d49160 100644
--- a/src/core/touch_selection_menu_controller.cpp
+++ b/src/core/touch_selection_menu_controller.cpp
@@ -53,17 +53,11 @@ TouchSelectionMenuController::~TouchSelectionMenuController()
int TouchSelectionMenuController::buttonCount()
{
- int buttonCount = 1;
-
- for (int commandId = 0; commandId <= static_cast<int>(Paste); ++commandId) {
- if (m_touchSelectionControllerClient->IsCommandIdEnabled(commandId))
- buttonCount++;
- }
-
- return buttonCount;
+ // Context menu should be always available
+ return qPopulationCount(static_cast<quint8>(availableActions())) + 1;
}
-bool TouchSelectionMenuController::isCommandEnabled(TouchSelectionCommand command)
+bool TouchSelectionMenuController::isCommandEnabled(TouchSelectionMenuController::TouchSelectionCommandFlag command)
{
return m_touchSelectionControllerClient->IsCommandIdEnabled(static_cast<int>(command));
}
@@ -88,4 +82,21 @@ void TouchSelectionMenuController::runContextMenu()
return m_touchSelectionControllerClient->RunContextMenu();
}
+TouchSelectionMenuController::TouchSelectionCommandFlags TouchSelectionMenuController::availableActions()
+{
+ TouchSelectionCommandFlags availableActions;
+
+ if (m_touchSelectionControllerClient->IsCommandIdEnabled(Cut)) {
+ availableActions |= TouchSelectionMenuController::Cut;
+ }
+ if (m_touchSelectionControllerClient->IsCommandIdEnabled(Copy)) {
+ availableActions |= TouchSelectionMenuController::Copy;
+ }
+ if (m_touchSelectionControllerClient->IsCommandIdEnabled(Paste)) {
+ availableActions |= TouchSelectionMenuController::Paste;
+ }
+
+ return availableActions;
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/touch_selection_menu_controller.h b/src/core/touch_selection_menu_controller.h
index 8955c7294..a90695c80 100644
--- a/src/core/touch_selection_menu_controller.h
+++ b/src/core/touch_selection_menu_controller.h
@@ -50,16 +50,19 @@ class TouchSelectionControllerClientQt;
class Q_WEBENGINECORE_PRIVATE_EXPORT TouchSelectionMenuController : public QObject {
Q_OBJECT
public:
- enum TouchSelectionCommand {
- Cut,
- Copy,
- Paste
+ enum TouchSelectionCommandFlag {
+ Cut = 0x1,
+ Copy = 0x2,
+ Paste = 0x4
};
+ Q_DECLARE_FLAGS(TouchSelectionCommandFlags, TouchSelectionCommandFlag);
+ Q_FLAG(TouchSelectionCommandFlag)
TouchSelectionMenuController(TouchSelectionControllerClientQt *touchSelectionControllerClient);
~TouchSelectionMenuController();
int buttonCount();
- bool isCommandEnabled(TouchSelectionCommand);
+ bool isCommandEnabled(TouchSelectionCommandFlag);
+ TouchSelectionCommandFlags availableActions();
public Q_SLOTS:
void cut();
diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt
index 30b0fa2cf..05340a3a7 100644
--- a/src/webenginequick/CMakeLists.txt
+++ b/src/webenginequick/CMakeLists.txt
@@ -22,6 +22,9 @@ qt_internal_add_qml_module(WebEngineQuick
api/qquickwebenginesingleton.cpp api/qquickwebenginesingleton_p.h
api/qquickwebenginetouchhandleprovider.cpp
api/qquickwebenginetouchhandleprovider_p_p.h
+ api/qquickwebenginetouchselectionmenurequest.cpp
+ api/qquickwebenginetouchselectionmenurequest_p.h
+ api/qquickwebenginetouchselectionmenurequest_p_p.h
api/qquickwebengineview.cpp api/qquickwebengineview_p.h
api/qquickwebengineview_p_p.h
api/qquickwebengineforeigntypes_p.h
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp
new file mode 100644
index 000000000..21948727e
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwebenginetouchselectionmenurequest_p.h"
+#include "qquickwebenginetouchselectionmenurequest_p_p.h"
+#include "touch_selection_menu_controller.h"
+
+QT_BEGIN_NAMESPACE
+
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Cut,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Cut)
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Copy,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Copy)
+ASSERT_ENUMS_MATCH(QQuickWebEngineTouchSelectionMenuRequest::Paste,
+ QtWebEngineCore::TouchSelectionMenuController::TouchSelectionCommandFlag::Paste)
+
+/*!
+ \class QWebEngineTouchSelectionMenuRequest
+ \since 6.3
+ \brief The QQuickWebEngineTouchSelectionMenuRequest class provides request for a touch selection menu.
+ \inmodule QtWebEngineQuick
+ QQuickWebEngineTouchSelectionMenuRequest is returned after a touch selection event,
+ and contains information about where the bounding box of touch selection is and what
+ actions are available.
+*/
+
+/*!
+ \enum QWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlag
+ \readonly
+ \since 6.3
+
+ The available operations in the current touch selection menu request.
+
+ \value Cut Cut is available.
+ \value Copy Copy is available.
+ \value Paste Paste is available.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::QQuickWebEngineTouchSelectionMenuRequest(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController)
+ : d(new QQuickWebEngineTouchSelectionMenuRequestPrivate(bounds, touchSelectionMenuController))
+{
+}
+
+QQuickWebEngineTouchSelectionMenuRequestPrivate::QQuickWebEngineTouchSelectionMenuRequestPrivate(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController)
+{
+ selectionBounds = bounds;
+ buttonCount = touchSelectionMenuController->buttonCount();
+ touchSelectionCommandFlags = touchSelectionMenuController->availableActions();
+}
+
+/*!
+ Destroys the touch selection menu request.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::~QQuickWebEngineTouchSelectionMenuRequest() = default;
+
+/*!
+ Returns the number of buttons that must be displayed, based on the available actions.
+*/
+int QQuickWebEngineTouchSelectionMenuRequest::buttonCount()
+{
+ return d->buttonCount;
+}
+
+/*!
+ \qmlproperty bool QQuickWebEngineTouchSelectionMenuRequest::accepted
+
+ Indicates whether the touch selection menu request has been
+ accepted by the signal handler.
+
+ If the property is \c false after any signal handlers
+ for WebEngineView::touchSelectionMenuRequested have been executed,
+ a default touch selection menu will be shown.
+ To prevent this, set \c{request.accepted} to \c true.
+
+ The default is \c false.
+*/
+bool QQuickWebEngineTouchSelectionMenuRequest::isAccepted() const
+{
+ return d->accepted;
+}
+
+void QQuickWebEngineTouchSelectionMenuRequest::setAccepted(bool accepted)
+{
+ d->accepted = accepted;
+}
+
+/*!
+ Returns the bound rectangle of text selection.
+*/
+QRect QQuickWebEngineTouchSelectionMenuRequest::selectionBounds()
+{
+ return d->selectionBounds;
+}
+
+/*!
+ Returns the available operations in the current context.
+*/
+QQuickWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlags QQuickWebEngineTouchSelectionMenuRequest::touchSelectionCommandFlags() const
+{
+ return static_cast<QQuickWebEngineTouchSelectionMenuRequest::TouchSelectionCommandFlags>(d->touchSelectionCommandFlags);
+}
+
+QT_END_NAMESPACE
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h
new file mode 100644
index 000000000..c6a8fc8c6
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_H
+#define QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWebEngineQuick/qtwebenginequickglobal.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtQml/qqmlregistration.h>
+
+namespace QtWebEngineCore {
+class TouchSelectionMenuController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineTouchSelectionMenuRequestPrivate;
+
+class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineTouchSelectionMenuRequest : public QObject
+{
+ Q_OBJECT
+public:
+ enum TouchSelectionCommandFlag {
+ Cut = 0x1,
+ Copy = 0x2,
+ Paste = 0x4
+ };
+
+ Q_DECLARE_FLAGS(TouchSelectionCommandFlags, TouchSelectionCommandFlag)
+ Q_FLAG(TouchSelectionCommandFlags)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ Q_PROPERTY(QRect selectionBounds READ selectionBounds CONSTANT FINAL REVISION(1))
+ Q_PROPERTY(TouchSelectionCommandFlags touchSelectionCommandFlags READ touchSelectionCommandFlags CONSTANT FINAL REVISION(1))
+ QML_NAMED_ELEMENT(QQuickWebEngineTouchSelectionMenuRequest)
+ QML_ADDED_IN_VERSION(6, 3)
+ QML_UNCREATABLE("")
+
+ QQuickWebEngineTouchSelectionMenuRequest(QRect bounds,
+ QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController);
+ virtual ~QQuickWebEngineTouchSelectionMenuRequest();
+
+ int buttonCount();
+ bool isAccepted() const;
+ void setAccepted(bool accepted);
+ QRect selectionBounds();
+ TouchSelectionCommandFlags touchSelectionCommandFlags() const;
+
+private:
+ QScopedPointer<QQuickWebEngineTouchSelectionMenuRequestPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_H
diff --git a/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h
new file mode 100644
index 000000000..9d72e7fee
--- /dev/null
+++ b/src/webenginequick/api/qquickwebenginetouchselectionmenurequest_p_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_H
+#define QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWebEngineQuick/private/qquickwebengineview_p.h>
+#include "qquickwebenginetouchselectionmenurequest_p.h"
+
+namespace QtWebEngineCore {
+class TouchSelectionMenuController;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWebEngineTouchSelectionMenuRequest;
+
+class QQuickWebEngineTouchSelectionMenuRequestPrivate
+{
+public:
+ QQuickWebEngineTouchSelectionMenuRequestPrivate(
+ QRect bounds, QtWebEngineCore::TouchSelectionMenuController *touchSelectionMenuController);
+
+ bool accepted = false;
+ QRect selectionBounds;
+ uint touchSelectionCommandFlags;
+ int buttonCount;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEBENGINETOUCHSELECTIONMENUREQUEST_P_P_H
diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp
index 8f02648e8..42460ca34 100644
--- a/src/webenginequick/api/qquickwebengineview.cpp
+++ b/src/webenginequick/api/qquickwebengineview.cpp
@@ -48,6 +48,7 @@
#include "qquickwebenginescriptcollection_p.h"
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginetouchhandleprovider_p_p.h"
+#include "qquickwebenginetouchselectionmenurequest_p.h"
#include "qquickwebengineview_p.h"
#include "qquickwebengineview_p_p.h"
@@ -1241,11 +1242,21 @@ QtWebEngineCore::TouchHandleDrawableClient *QQuickWebEngineViewPrivate::createTo
void QQuickWebEngineViewPrivate::showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *menuController, const QRect &selectionBounds, const QSize &handleSize)
{
Q_UNUSED(handleSize);
+ Q_Q(QQuickWebEngineView);
const int kSpacingBetweenButtons = 2;
const int kMenuButtonMinWidth = 63;
const int kMenuButtonMinHeight = 38;
+ QQuickWebEngineTouchSelectionMenuRequest *request = new QQuickWebEngineTouchSelectionMenuRequest(
+ selectionBounds, menuController);
+ qmlEngine(q)->newQObject(request);
+ Q_EMIT q->touchSelectionMenuRequested(request);
+
+ if (request->isAccepted()) {
+ return;
+ }
+
int buttonCount = menuController->buttonCount();
if (buttonCount == 1) {
menuController->runContextMenu();
diff --git a/src/webenginequick/api/qquickwebengineview_p.h b/src/webenginequick/api/qquickwebengineview_p.h
index 3d3356a4e..1a42726e4 100644
--- a/src/webenginequick/api/qquickwebengineview_p.h
+++ b/src/webenginequick/api/qquickwebengineview_p.h
@@ -87,6 +87,7 @@ class QWebEngineNewWindowRequest;
class QWebEngineQuotaRequest;
class QWebEngineRegisterProtocolHandlerRequest;
class QQuickWebEngineScriptCollection;
+class QQuickWebEngineTouchSelectionMenuRequest;
class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
@@ -563,6 +564,7 @@ Q_SIGNALS:
Q_REVISION(1,11) void canGoBackChanged();
Q_REVISION(1,11) void canGoForwardChanged();
Q_REVISION(1,12) void newWindowRequested(QQuickWebEngineNewWindowRequest *request);
+ Q_REVISION(6,3) void touchSelectionMenuRequested(QQuickWebEngineTouchSelectionMenuRequest *request);
protected:
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
diff --git a/src/webenginequick/doc/src/touch_selection_menu_request.qdoc b/src/webenginequick/doc/src/touch_selection_menu_request.qdoc
new file mode 100644
index 000000000..da4c2062a
--- /dev/null
+++ b/src/webenginequick/doc/src/touch_selection_menu_request.qdoc
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype TouchSelectionMenuRequest
+ //! \instantiates QQuickWebEngineTouchSelectionMenuRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 6.3
+
+ \brief A request for showing a touch selection menu.
+
+ A TouchSelectionMenuRequest is passed as an argument of the
+ WebEngineView::touchSelectionMenuRequest signal. It provides further
+ information about the context of the request. The \l selectionBounds
+ property provides the origin of the request.
+
+ The \l accepted property of the request indicates whether the request
+ is handled by the user code or the default touch selection menu should
+ be displayed.
+
+ The following code uses a custom menu to handle the request:
+
+ \code
+ WebEngineView {
+ id: view
+ // ...
+ onTouchSelectionMenuRequested: function(request) {
+ request.accepted = true;
+ myMenu.x = request.selectionBounds.x;
+ myMenu.y = request.selectionBounds.y;
+ myMenu.trigger.connect(view.triggerWebAction);
+ myMenu.popup();
+ }
+ // ...
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty rect TouchSelectionMenuRequest::selectionBounds
+ \readonly
+
+ The position of the bound rectangle from the touch text
+ selection.
+*/
+
+/*!
+ \qmlproperty bool TouchSelectionMenuRequest::accepted
+
+ Indicates whether the touch selection menu request has
+ been handled by the signal handler.
+
+ If the property is \c false after any signal handlers
+ for WebEngineView::touchSelectionMenuRequested have been executed,
+ a default touch selection menu will be shown.
+ To prevent this, set \c{request.accepted} to \c true.
+
+ The default is \c false.
+
+ \note The default content of the touch selection menu depends
+ on the web element for which the request was actually generated.
+*/
+
+
+/*!
+ \qmlproperty flags QQuickWebEngineTouchSelectionMenuRequest::touchSelectionCommandFlags
+ \readonly
+ \since QtWebEngine 6.3
+
+ \note In the default touch selection menu, showing the context menu
+ is always available as a separate action.
+
+ \value QQuickWebEngineTouchSelectionMenuRequest.Cut
+ Cut is available.
+ \value QQuickWebEngineTouchSelectionMenuRequest.Copy
+ Copy is available.
+ \value QQuickWebEngineTouchSelectionMenuRequest.Paste
+ Paste is available.
+*/