summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-03-20 08:46:55 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-22 12:48:53 +0000
commit9529f13652ce4c6297fb6b14610b1da01e891560 (patch)
treeed74df225b667df4cc72adf3d25acfc6ab0b2aa0 /examples
parentb71403faeedf2955e3af541f9e140305af9ba0a8 (diff)
downloadqtwebengine-9529f13652ce4c6297fb6b14610b1da01e891560.tar.gz
Move custom touch handles example to manual tests
Move and add missing parts as snippet. Task-number: QTBUG-108751 Change-Id: I25849941700337626ca46e399fdb52264bc4659a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Yigit Akcay <yigit.akcay@qt.io> (cherry picked from commit 55f9fc348278b2aa8985ec9c1e7e092f88f68f83) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/webenginequick/CMakeLists.txt1
-rw-r--r--examples/webenginequick/customtouchhandle/CMakeLists.txt48
-rw-r--r--examples/webenginequick/customtouchhandle/customtouchhandle.pro10
-rw-r--r--examples/webenginequick/customtouchhandle/doc/images/customtouchhandle.jpgbin47646 -> 0 bytes
-rw-r--r--examples/webenginequick/customtouchhandle/doc/src/customtouchhandle.qdoc42
-rw-r--r--examples/webenginequick/customtouchhandle/main.cpp19
-rw-r--r--examples/webenginequick/customtouchhandle/main.qml96
-rw-r--r--examples/webenginequick/customtouchhandle/qml.qrc5
-rw-r--r--examples/webenginequick/webenginequick.pro1
9 files changed, 0 insertions, 222 deletions
diff --git a/examples/webenginequick/CMakeLists.txt b/examples/webenginequick/CMakeLists.txt
index 30ecb9808..ef140ee72 100644
--- a/examples/webenginequick/CMakeLists.txt
+++ b/examples/webenginequick/CMakeLists.txt
@@ -1,7 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-qt_internal_add_example(customtouchhandle)
qt_internal_add_example(lifecycle)
qt_internal_add_example(quicknanobrowser)
qt_internal_add_example(webengineaction)
diff --git a/examples/webenginequick/customtouchhandle/CMakeLists.txt b/examples/webenginequick/customtouchhandle/CMakeLists.txt
deleted file mode 100644
index e84e97524..000000000
--- a/examples/webenginequick/customtouchhandle/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(customtouchhandle LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginequick/customtouchhandle")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui WebEngineQuick)
-
-qt_add_executable(customtouchhandle
- main.cpp
-)
-
-set_target_properties(customtouchhandle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(customtouchhandle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::WebEngineQuick
-)
-
-# Resources:
-set(qml_resource_files
- "main.qml"
-)
-
-qt6_add_resources(customtouchhandle "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-
-install(TARGETS customtouchhandle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/webenginequick/customtouchhandle/customtouchhandle.pro b/examples/webenginequick/customtouchhandle/customtouchhandle.pro
deleted file mode 100644
index a74ef3146..000000000
--- a/examples/webenginequick/customtouchhandle/customtouchhandle.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-
-QT += webenginequick
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/webenginequick/customtouchhandle
-INSTALLS += target
diff --git a/examples/webenginequick/customtouchhandle/doc/images/customtouchhandle.jpg b/examples/webenginequick/customtouchhandle/doc/images/customtouchhandle.jpg
deleted file mode 100644
index bd65c083d..000000000
--- a/examples/webenginequick/customtouchhandle/doc/images/customtouchhandle.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customtouchhandle/doc/src/customtouchhandle.qdoc b/examples/webenginequick/customtouchhandle/doc/src/customtouchhandle.qdoc
deleted file mode 100644
index 742f65b6b..000000000
--- a/examples/webenginequick/customtouchhandle/doc/src/customtouchhandle.qdoc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example webenginequick/customtouchhandle
- \title WebEngine Qt Quick Custom Touch Handle Example
- \ingroup webengine-examples
- \brief Shows custom touch handles upon touch selection events.
-
- \image customtouchhandle.jpg
-
- \e {WebEngine Qt Quick Touch Handle Example} demonstrates how to use
- custom touch handles when a touch selection event happens. It shows the
- minimum amount of code needed to use custom touch handle delegates, and
- can be used as a basis for further experimentation.
-
- \section1 Custom Touch Handle
-
- In \c main.qml we create the custom touch handle delegate.
-
- \quotefromfile webenginequick/customtouchhandle/main.qml
- \skipto WebEngineView
- \printuntil /^\ {4}\}/
-
- \section1 QML Code
-
- In \c main.qml we create the top level window filled by a
- \l{WebEngineView} item loading the \l{Qt Homepage}.
- To display custom touch handles, a QML item should be delegated to
- \l{WebEngineView::touchHandleDelegate}.
-
- The touch handle's position, opacity, and visibility is automatically updated.
-
- \note If no delegate is provided, Chromium's default touch handles will appear.
-
- \section1 Requirements
-
- The example requires a working internet connection to render the
- \l{Qt Homepage} and a touch-enabled input device to trigger touch
- events.
- An optional system proxy should be picked up automatically.
-*/
diff --git a/examples/webenginequick/customtouchhandle/main.cpp b/examples/webenginequick/customtouchhandle/main.cpp
deleted file mode 100644
index f1b70b024..000000000
--- a/examples/webenginequick/customtouchhandle/main.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include <QtWebEngineQuick/qtwebenginequickglobal.h>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication::setOrganizationName("QtExamples");
- QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
- QtWebEngineQuick::initialize();
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- return app.exec();
-}
diff --git a/examples/webenginequick/customtouchhandle/main.qml b/examples/webenginequick/customtouchhandle/main.qml
deleted file mode 100644
index c40b4c73b..000000000
--- a/examples/webenginequick/customtouchhandle/main.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2022 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Window
-import QtWebEngine
-import QtQuick.Layouts
-import QtQuick.Controls
-
-ApplicationWindow {
- width: 1024
- height: 750
- visible: true
- header: ToolBar {
- RowLayout {
- anchors.fill: parent
-
- ToolButton {
- property int itemAction: WebEngineView.Back
- text: webEngineView.action(itemAction).text
- enabled: webEngineView.action(itemAction).enabled
- onClicked: webEngineView.action(itemAction).trigger()
- icon.name: webEngineView.action(itemAction).iconName
- display: AbstractButton.TextUnderIcon
- }
-
- ToolButton {
- property int itemAction: WebEngineView.Forward
- text: webEngineView.action(itemAction).text
- enabled: webEngineView.action(itemAction).enabled
- onClicked: webEngineView.action(itemAction).trigger()
- icon.name: webEngineView.action(itemAction).iconName
- display: AbstractButton.TextUnderIcon
- }
-
- ToolButton {
- property int itemAction: webEngineView.loading ? WebEngineView.Stop : WebEngineView.Reload
- text: webEngineView.action(itemAction).text
- enabled: webEngineView.action(itemAction).enabled
- onClicked: webEngineView.action(itemAction).trigger()
- icon.name: webEngineView.action(itemAction).iconName
- display: AbstractButton.TextUnderIcon
- }
-
- TextField {
- Layout.fillWidth: true
- text: webEngineView.url
- selectByMouse: true
- onEditingFinished: webEngineView.url = text
- }
-
- Label { text: 'Handle: ' }
- ComboBox {
- model: [ 'Default', 'Circle', 'Square' ]
-
- onCurrentValueChanged: {
- if (currentValue == 'Circle')
- webEngineView.touchHandleDelegate = circleTouchHandle
- else if (currentValue == 'Square')
- webEngineView.touchHandleDelegate = rectTouchHandle
- else
- webEngineView.touchHandleDelegate = null
- }
-
- Component.onCompleted: currentIndex = indexOfValue('Square')
- }
- }
- }
-
- Component {
- id: circleTouchHandle
- Rectangle {
- color: "blue"
- border.color: "black"
- border.width: 2
- radius: 50
- }
- }
-
- Component {
- id: rectTouchHandle
- Rectangle {
- border.color: "black"
- border.width: 2
- radius: 2
- onVisibleChanged: if (visible) { color = 'yellow'; cAnim.restart(); }
- ColorAnimation on color { id: cAnim; to: 'red'; duration: 1000 }
- }
- }
-
- WebEngineView {
- anchors.fill: parent
- id: webEngineView
- url: "https://www.qt.io"
- }
-}
diff --git a/examples/webenginequick/customtouchhandle/qml.qrc b/examples/webenginequick/customtouchhandle/qml.qrc
deleted file mode 100644
index 5f6483ac3..000000000
--- a/examples/webenginequick/customtouchhandle/qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/webenginequick/webenginequick.pro b/examples/webenginequick/webenginequick.pro
index 8c7343017..9711ccb3a 100644
--- a/examples/webenginequick/webenginequick.pro
+++ b/examples/webenginequick/webenginequick.pro
@@ -1,7 +1,6 @@
TEMPLATE=subdirs
SUBDIRS += \
- customtouchhandle \
quicknanobrowser \
webengineaction