summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-03-20 08:46:13 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-22 12:48:47 +0000
commitb71403faeedf2955e3af541f9e140305af9ba0a8 (patch)
tree5c3537c500c5c65dc473c9fd3e2d45b327fdcd95 /examples
parent7d9805df3a471e7172bf72ff1bc08c63ccfd67fa (diff)
downloadqtwebengine-b71403faeedf2955e3af541f9e140305af9ba0a8.tar.gz
Move custom dialogs example to manual tests
This example shows how to use dialogs, however documentation already provides snippets for that added in 3cbe59e29a. The only missing one was tooltip, therefore add missing snippet and move example to manual tests. Task-number: QTBUG-108751 Change-Id: I84eda805455fb0276046ed1089389d605a8af672 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit 6bf30525ee49d270dae6a6440bc607513f21237c) 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/customdialogs/CMakeLists.txt76
-rw-r--r--examples/webenginequick/customdialogs/MessageRectangle.qml18
-rw-r--r--examples/webenginequick/customdialogs/SwitchButton.qml23
-rw-r--r--examples/webenginequick/customdialogs/WebView.qml117
-rw-r--r--examples/webenginequick/customdialogs/customdialogs.pro18
-rw-r--r--examples/webenginequick/customdialogs/customdialogs.qrc24
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.pngbin18549 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.pngbin5064 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-color1.pngbin9729 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-color2.pngbin3952 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-file1.pngbin18540 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-file2.pngbin6773 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-menu.pngbin5484 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.pngbin14845 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.pngbin4764 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.pngbin1617 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/images/customdialogs.pngbin9093 -> 0 bytes
-rw-r--r--examples/webenginequick/customdialogs/doc/src/customdialogs.qdoc309
-rw-r--r--examples/webenginequick/customdialogs/forms/Authentication.qml31
-rw-r--r--examples/webenginequick/customdialogs/forms/AuthenticationForm.ui.qml137
-rw-r--r--examples/webenginequick/customdialogs/forms/ColorCell.qml16
-rw-r--r--examples/webenginequick/customdialogs/forms/ColorPicker.qml31
-rw-r--r--examples/webenginequick/customdialogs/forms/ColorPickerForm.ui.qml186
-rw-r--r--examples/webenginequick/customdialogs/forms/CustomButton.qml61
-rw-r--r--examples/webenginequick/customdialogs/forms/FilePicker.qml44
-rw-r--r--examples/webenginequick/customdialogs/forms/FilePickerForm.ui.qml128
-rw-r--r--examples/webenginequick/customdialogs/forms/FileRow.qml44
-rw-r--r--examples/webenginequick/customdialogs/forms/JavaScript.qml44
-rw-r--r--examples/webenginequick/customdialogs/forms/JavaScriptForm.ui.qml117
-rw-r--r--examples/webenginequick/customdialogs/forms/Menu.qml22
-rw-r--r--examples/webenginequick/customdialogs/forms/MenuForm.ui.qml65
-rw-r--r--examples/webenginequick/customdialogs/forms/TouchSelectionMenu.qml14
-rw-r--r--examples/webenginequick/customdialogs/forms/TouchSelectionMenuForm.ui.qml39
-rw-r--r--examples/webenginequick/customdialogs/forms/forms.qmlproject45
-rw-r--r--examples/webenginequick/customdialogs/icon.svg24
-rw-r--r--examples/webenginequick/customdialogs/index.html51
-rw-r--r--examples/webenginequick/customdialogs/main.cpp32
-rw-r--r--examples/webenginequick/customdialogs/main.qml56
-rw-r--r--examples/webenginequick/customdialogs/server.cpp47
-rw-r--r--examples/webenginequick/customdialogs/server.h29
-rw-r--r--examples/webenginequick/customdialogs/style.css37
-rw-r--r--examples/webenginequick/webenginequick.pro1
43 files changed, 0 insertions, 1887 deletions
diff --git a/examples/webenginequick/CMakeLists.txt b/examples/webenginequick/CMakeLists.txt
index 4b64c2926..30ecb9808 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(customdialogs)
qt_internal_add_example(customtouchhandle)
qt_internal_add_example(lifecycle)
qt_internal_add_example(quicknanobrowser)
diff --git a/examples/webenginequick/customdialogs/CMakeLists.txt b/examples/webenginequick/customdialogs/CMakeLists.txt
deleted file mode 100644
index 7908bec62..000000000
--- a/examples/webenginequick/customdialogs/CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(customdialogs LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginequick/customdialogs")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui WebEngineQuick)
-
-qt_add_executable(customdialogs
- main.cpp
- server.cpp server.h
-)
-
-set_target_properties(customdialogs PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(customdialogs PUBLIC
- Qt::Core
- Qt::Gui
- Qt::WebEngineQuick
-)
-
-set(customdialogs_resource_files
- "MessageRectangle.qml"
- "SwitchButton.qml"
- "WebView.qml"
- "forms/Authentication.qml"
- "forms/AuthenticationForm.ui.qml"
- "forms/ColorCell.qml"
- "forms/ColorPicker.qml"
- "forms/ColorPickerForm.ui.qml"
- "forms/CustomButton.qml"
- "forms/FilePicker.qml"
- "forms/FilePickerForm.ui.qml"
- "forms/FileRow.qml"
- "forms/JavaScript.qml"
- "forms/JavaScriptForm.ui.qml"
- "forms/Menu.qml"
- "forms/MenuForm.ui.qml"
- "forms/TouchSelectionMenu.qml"
- "forms/TouchSelectionMenuForm.ui.qml"
- "icon.svg"
- "index.html"
- "main.qml"
- "style.css"
-)
-
-qt_add_resources(customdialogs "customdialogs"
- PREFIX
- "/"
- FILES
- ${customdialogs_resource_files}
-)
-
-if(TARGET Qt::Widgets)
- target_link_libraries(customdialogs PUBLIC
- Qt::Widgets
- )
-endif()
-
-install(TARGETS customdialogs
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/webenginequick/customdialogs/MessageRectangle.qml b/examples/webenginequick/customdialogs/MessageRectangle.qml
deleted file mode 100644
index 09a202cf3..000000000
--- a/examples/webenginequick/customdialogs/MessageRectangle.qml
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-Rectangle {
- property alias text: messageText.text
- width: parent.width
- height: 30
- visible: false
- color: "#80c342"
- Text {
- id: messageText
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- font.pointSize: 12
- }
-}
diff --git a/examples/webenginequick/customdialogs/SwitchButton.qml b/examples/webenginequick/customdialogs/SwitchButton.qml
deleted file mode 100644
index 69fc1427e..000000000
--- a/examples/webenginequick/customdialogs/SwitchButton.qml
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-
-Item {
- width: parent.width
- height: 40
- property alias checked: switcher.checked
- RowLayout {
- anchors.centerIn: parent
- Text {
- text: qsTr("Use default dialogs")
- font.pointSize: 12
- }
- Switch {
- id: switcher
- checked: true
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/WebView.qml b/examples/webenginequick/customdialogs/WebView.qml
deleted file mode 100644
index 5c99ee7e7..000000000
--- a/examples/webenginequick/customdialogs/WebView.qml
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtWebEngine
-
-WebEngineView {
- id: view
- url: "qrc:/index.html"
- property bool useDefaultDialogs: true
- signal openForm(var form)
-
- Rectangle {
- id: tooltip
- width: 200
- height: 30
- z: 50
- visible: false
- color: "gray"
- border.color: "black"
- border.width: 2
- radius: 3
-
- property string text: ""
-
- Text {
- x: 0
- y: 0
- color: "#ffffff"
- text: parent.text
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- font.bold: false
- }
-
- }
-
- onContextMenuRequested: function(request) {
- // we only show menu for links with #openMenu
- if (!request.linkUrl.toString().endsWith("#openMenu")) {
- request.accepted = true;
- return;
- }
- // return early to show default menu
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/Menu.qml"),
- properties: {"request": request}});
- }
-
- onTooltipRequested: function(request) {
- if (useDefaultDialogs)
- return;
-
- if (request.type == TooltipRequest.Show) {
- tooltip.visible = true;
- tooltip.x = request.x;
- tooltip.y = request.y;
- tooltip.text = request.text;
- } else {
- tooltip.visible = false;
- }
-
- request.accepted = true;
- }
-
- onAuthenticationDialogRequested: function(request) {
- if (useDefaultDialogs) {
- // do not show proxy error page
- view.url = "qrc:/index.html"
- return;
- }
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/Authentication.qml"),
- properties: {"request": request}});
- }
-
- onJavaScriptDialogRequested: function(request) {
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/JavaScript.qml"),
- properties: {"request": request}});
- }
-
- onColorDialogRequested: function(request) {
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/ColorPicker.qml"),
- properties: {"request": request}});
- }
-
- onFileDialogRequested: function(request) {
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/FilePicker.qml"),
- properties: {"request": request}});
-
- }
-
- onTouchSelectionMenuRequested: function(request) {
- if (useDefaultDialogs)
- return;
-
- request.accepted = true;
- openForm({item: Qt.resolvedUrl("forms/TouchSelectionMenu.qml"),
- properties: {"request": request}});
- }
-}
diff --git a/examples/webenginequick/customdialogs/customdialogs.pro b/examples/webenginequick/customdialogs/customdialogs.pro
deleted file mode 100644
index 1b9a6778e..000000000
--- a/examples/webenginequick/customdialogs/customdialogs.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-QT += webenginequick
-
-HEADERS += \
- server.h
-
-SOURCES += \
- main.cpp \
- server.cpp
-
-RESOURCES += \
- customdialogs.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/webenginequick/customdialogs
-INSTALLS += target
-
-qtHaveModule(widgets) {
- QT += widgets # QApplication is required to get native styling with QtQuickControls
-}
diff --git a/examples/webenginequick/customdialogs/customdialogs.qrc b/examples/webenginequick/customdialogs/customdialogs.qrc
deleted file mode 100644
index bb2677198..000000000
--- a/examples/webenginequick/customdialogs/customdialogs.qrc
+++ /dev/null
@@ -1,24 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>forms/AuthenticationForm.ui.qml</file>
- <file>forms/Authentication.qml</file>
- <file>forms/ColorCell.qml</file>
- <file>forms/ColorPickerForm.ui.qml</file>
- <file>forms/ColorPicker.qml</file>
- <file>forms/CustomButton.qml</file>
- <file>forms/FilePickerForm.ui.qml</file>
- <file>forms/FilePicker.qml</file>
- <file>forms/FileRow.qml</file>
- <file>forms/JavaScriptForm.ui.qml</file>
- <file>forms/JavaScript.qml</file>
- <file>forms/MenuForm.ui.qml</file>
- <file>forms/Menu.qml</file>
- <file>icon.svg</file>
- <file>index.html</file>
- <file>main.qml</file>
- <file>MessageRectangle.qml</file>
- <file>style.css</file>
- <file>SwitchButton.qml</file>
- <file>WebView.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.png
deleted file mode 100644
index 042712f5c..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.png
deleted file mode 100644
index 41828d36d..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-color1.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-color1.png
deleted file mode 100644
index 7f0492f87..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-color1.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-color2.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-color2.png
deleted file mode 100644
index 9087fdf14..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-color2.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-file1.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-file1.png
deleted file mode 100644
index 5023ced6f..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-file1.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-file2.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-file2.png
deleted file mode 100644
index aa25579d7..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-file2.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-menu.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-menu.png
deleted file mode 100644
index 3409c951c..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-menu.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.png
deleted file mode 100644
index c34080b4d..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.png
deleted file mode 100644
index 2c8d92649..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.png b/examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.png
deleted file mode 100644
index 498de9595..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/images/customdialogs.png b/examples/webenginequick/customdialogs/doc/images/customdialogs.png
deleted file mode 100644
index c42114a16..000000000
--- a/examples/webenginequick/customdialogs/doc/images/customdialogs.png
+++ /dev/null
Binary files differ
diff --git a/examples/webenginequick/customdialogs/doc/src/customdialogs.qdoc b/examples/webenginequick/customdialogs/doc/src/customdialogs.qdoc
deleted file mode 100644
index d89d76f71..000000000
--- a/examples/webenginequick/customdialogs/doc/src/customdialogs.qdoc
+++ /dev/null
@@ -1,309 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example webenginequick/customdialogs
- \title WebEngine Qt Quick Custom Dialogs Example
- \ingroup webengine-examples
- \brief Customizes UI elements of \QWE's dialogs.
-
- \image customdialogs.png
-
- A web page might request dialogs for various purposes, such as
- authentication, picking colors, choosing files, and responding to JavaScript
- alerts, confirmation requests, and prompts.
-
- \e {Custom Dialogs} demonstrates how to use WebEngine dialog request objects
- to implement custom dialogs for use instead of the default dialogs.
-
- \include examples-run.qdocinc
-
- \section1 UI Elements of WebEngineView
-
- In this example, we create a simple \c index.html page that contains buttons
- and text fields for triggering a context menu and the following dialogs:
-
- \list
- \li HTTP Authentication Dialog
- \li Proxy Authentication Dialog
- \li JavaScript Alert, Confirm, and Prompt Dialogs
- \li Color Picker Dialog
- \li File Picker Dialog
- \endlist
-
- \section1 Triggering Dialogs
-
- As mentioned, the \c index.html file is responsible for triggering the
- dialogs from the side of HTML and JavaScript. Additionally, the example
- program starts a localhost TCP server returning the mocked HTTP responses
- needed to trigger proxy and HTTP authentication dialogs.
-
- \section1 Custom Dialogs
-
- The custom dialogs are just \e {Qt Quick Designer UI Forms} without any
- business logic. The point here is to present the glue code that is required
- to display the custom dialog for a particular web engine dialog or a menu
- request.
-
- \section1 Creating the Main Window
-
- In \c main.cpp, we initialize the WebEngine the same way as in the
- \l {WebEngine Qt Quick Minimal Example}:
-
- \quotefromfile webenginequick/customdialogs/main.cpp
- \skipto main
- \printuntil }
-
- In addition, we set up a proxy and a TCP server to be able to simulate proxy
- and HTTP authetication requests.
-
- In \c main.qml, we create a top level window, which contains a StackView
- with a SwitchButton and a WebView:
-
- \quotefromfile webenginequick/customdialogs/main.qml
- \skipto Window
- \printuntil Component
- \printuntil }
- \printline }
-
- \section1 Handling Web Engine Requests
-
- In this example, we implement the handling of the following web engine
- requests:
-
- \list
- \li ContextMenuRequest
- \li AuthenticationDialogRequest
- \li JavaScriptDialogRequest
- \li ColorDialogRequest
- \li FileDialogRequest
- \endlist
-
- \section2 Context Menu Requests
-
- \l [QML]{ContextMenuRequest} is a request object that is passed as a
- parameter of the WebEngineView::contextMenuRequested signal. We use the
- \c onContextMenuRequested signal handler to handle requests for
- \c #openMenu URL links:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onContextMenuRequested
- \printuntil }
- \printuntil }
- \printuntil }
- \dots 4
- \skipuntil onFileDialogRequested
- \skipuntil }});
- \skipuntil }
- \skipto }
- \printline }
-
- The first text field from the top on our page triggers the request. Next,
- we check whether we should use the default menu. If not, we accept the
- request and switch the view to show the \c MenuForm:
-
- \image customdialogs-menu.png
-
- \quotefromfile webenginequick/customdialogs/forms/Menu.qml
- \skipto MenuForm
- \printuntil }
- \printuntil }
-
- To keep things simple, we do not provide any logic on component completion,
- and we simply close the form on any action.
-
- \section2 Tooltip Requests
-
- \l [QML]{TooltipRequest} is a request object that is passed as a
- parameter of the WebEngineView::tooltipRequested signal. We use the
- \c onTooltipRequested signal handler to handle requests for
- custom tooltip menus at specific positions:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onTooltipRequested
- \printuntil }
- \printuntil }
- \printuntil }
- \dots 4
- \skipuntil onFileDialogRequested
- \skipuntil }});
- \skipuntil }
- \skipto }
- \printline }
-
- The second text field from the top on our page triggers the request. Next,
- we check whether we should use the default menu. If not, we accept the
- request and show a custom QML element as tooltip:
-
- \image customdialogs-tooltip.png
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto Rectangle
- \printuntil }
-
- \section2 Authentication Dialog Requests
-
- \image customdialogs-auth1.png
-
- \l [QML]{AuthenticationDialogRequest} is a request object that is passed
- as a parameter of the WebEngineView::authenticationDialogRequested signal:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onAuthenticationDialogRequested
- \printuntil }
- \printuntil }
- \dots 4
- \skipuntil onFileDialogRequested
- \skipuntil }});
- \skipuntil }
- \skipto }
- \printline }
-
- We use the \c onAuthenticationDialogRequested signal handler to check
- whether we should use the default authentication dialog. If not, we accept
- the request and switch the view to show the \c AuthenticationForm:
-
- \image customdialogs-auth2.png
-
- \quotefromfile webenginequick/customdialogs/forms/Authentication.qml
- \skipto AuthenticationForm
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
-
- On component completion, we log the request type. The user can fill in the
- credentials and click \uicontrol Login. We provide \c onClicked handlers to
- accept or reject the authentication dialog. The TCP server on localhost does
- not handle real authentication, and therefore we call \c rejectDialog()
- instead of \c acceptDialog() also for the login button \c clicked signal.
-
- \section2 JavaScript Dialog Requests
-
- \image customdialogs-prompt1.png
-
- \l [QML]{JavaScriptDialogRequest} is a request object that is passed as a
- parameter of the WebEngineView::javaScriptDialogRequested signal:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onJavaScriptDialogRequested
- \printuntil }
- \printuntil }
- \dots 4
- \skipuntil onFileDialogRequested
- \skipuntil }});
- \skipuntil }
- \skipto }
- \printline }
-
- We use the \c onJavaScriptDialogRequested signal handler to check
- whether we should use the default JavaScript dialog. If not, we accept the
- request and switch the view to show the \c JavaScriptForm:
-
- \image customdialogs-prompt2.png
-
- \quotefromfile webenginequick/customdialogs/forms/JavaScript.qml
- \skipto JavaScriptForm
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
-
- On component completion, we customize the form based on the request type.
- For a JavaScript prompt dialog we use \c dialogAccept() with the
- \c prompt.text argument.
-
- \section2 Color Dialog Requests
-
- \image customdialogs-color1.png
-
- \l [QML]{ColorDialogRequest} is a request object that is passed as a
- parameter of the WebEngineView::colorDialogRequested signal:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onColorDialogRequested
- \printuntil }
- \printuntil }
- \dots 4
- \skipuntil onFileDialogRequested
- \skipuntil }});
- \skipuntil }
- \skipto }
- \printline }
-
- We use the \c onColorDialogRequested signal handler to check whether
- we should use the default color picker dialog. If not, we accept the request
- and switch the view to show the \c ColorPickerForm:
-
- \image customdialogs-color2.png
-
- \quotefromfile webenginequick/customdialogs/forms/ColorPicker.qml
- \skipto ColorPickerForm
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
-
- On component completion, we create callbacks for all the color cells. When
- the user selects the color and clicks \c OK, we pass the selected color to
- the \c dialogAccept() method.
-
- \section2 File Dialog Requests
-
- \image customdialogs-file1.png
-
- \l [QML]{FileDialogRequest} is a request object that is passed as a
- parameter of the WebEngineView::fileDialogRequested signal:
-
- \quotefromfile webenginequick/customdialogs/WebView.qml
- \skipto WebEngineView
- \printuntil {
- \dots 4
- \skipto onFileDialogRequested
- \printuntil }
- \printuntil }
- \printuntil }
-
- We use the \c onFileDialogRequested signal handler to check whether
- we should use the default file picker dialog. If not, we accept the request
- and switch the view to show the \c FilePickerForm:
-
- \image customdialogs-file2.png
-
- \quotefromfile webenginequick/customdialogs/forms/FilePicker.qml
- \skipto FilePickerForm
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
- \printuntil }
-
- On component completion, we create callbacks for selecting files. When the user selects a
- file and clicks \c OK, we pass the selected file to the \c dialogAccept
- method.
-
-*/
diff --git a/examples/webenginequick/customdialogs/forms/Authentication.qml b/examples/webenginequick/customdialogs/forms/Authentication.qml
deleted file mode 100644
index 151a7c4aa..000000000
--- a/examples/webenginequick/customdialogs/forms/Authentication.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtWebEngine
-
-AuthenticationForm {
- property QtObject request
- signal closeForm()
-
- cancelButton.onClicked: {
- request.dialogReject();
- closeForm();
- }
-
- loginButton.onClicked: {
- request.dialogReject();
- closeForm();
- }
-
- Component.onCompleted: {
- switch (request.type) {
- case AuthenticationDialogRequest.AuthenticationTypeHTTP:
- console.log("HTTP Authentication Required. Host says: " + request.realm);
- break;
- case AuthenticationDialogRequest.AuthenticationTypeProxy:
- console.log("Proxy Authentication Required for: " + request.proxyHost);
- break;
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/AuthenticationForm.ui.qml b/examples/webenginequick/customdialogs/forms/AuthenticationForm.ui.qml
deleted file mode 100644
index f14986b20..000000000
--- a/examples/webenginequick/customdialogs/forms/AuthenticationForm.ui.qml
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-import QtQuick.Controls
-
-Item {
- id: item1
- property alias cancelButton: cancelButton
- property alias loginButton: loginButton
- property alias userName: userName
- property alias password: password
-
- ColumnLayout {
- id: columnLayout
- anchors.topMargin: 20
- anchors.top: parent.top
- anchors.bottomMargin: 20
- anchors.bottom: parent.bottom
- anchors.rightMargin: 20
- anchors.right: parent.right
- anchors.leftMargin: 20
- anchors.left: parent.left
-
- Image {
- id: image
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- source: "qrc:/icon.svg"
- }
-
- Rectangle {
- id: rectangle
- width: parent.width
- height: 30
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#25a6e2"
- }
- GradientStop {
- color: "#188bd0"
- }
- }
-
- Text {
- id: textArea
- x: 54
- y: 5
- color: "#ffffff"
- text: qsTr("Restricted Area")
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- }
-
- Item {
- width: 40
- height: 40
- }
-
- Text {
- id: userNameText
- text: qsTr("Username:")
- font.pointSize: 12
- }
-
- TextField {
- id: userName
- width: 300
- height: 22
- Layout.fillWidth: true
- font.pointSize: 12
- color: "black"
-
- background: Rectangle {
- color: "white"
- border.color: "black"
- border.width: 1
- }
- }
-
- Text {
- id: passwordText
- text: qsTr("Password:")
- font.pointSize: 12
- }
-
- TextField {
- id: password
- width: 300
- height: 26
- Layout.fillWidth: true
- font.pointSize: 12
- color: "black"
- echoMode: TextInput.Password
-
- background: Rectangle {
- color: "white"
- border.color: "black"
- border.width: 1
- }
- }
-
- Item {
- Layout.fillHeight: true
- }
-
- RowLayout {
- id: rowLayout
- width: 100
- height: 100
-
- Item {
- Layout.fillWidth: true
- }
-
- CustomButton {
- id: cancelButton
- width: 90
- height: 30
- btnText: qsTr("Cancel")
- btnBlue: false
- }
-
- CustomButton {
- id: loginButton
- width: 90
- height: 30
- btnText: qsTr("Login")
- btnBlue: false
- }
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/ColorCell.qml b/examples/webenginequick/customdialogs/forms/ColorCell.qml
deleted file mode 100644
index 57151780c..000000000
--- a/examples/webenginequick/customdialogs/forms/ColorCell.qml
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-Rectangle {
- id: rectangle
- width: 50
- height: 50
- signal clicked()
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: rectangle.clicked()
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/ColorPicker.qml b/examples/webenginequick/customdialogs/forms/ColorPicker.qml
deleted file mode 100644
index 63269ddff..000000000
--- a/examples/webenginequick/customdialogs/forms/ColorPicker.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-ColorPickerForm {
- property QtObject request
- signal closeForm()
-
- okButton.onClicked: {
- request.dialogAccept(colorPicker.color);
- closeForm();
- }
-
- cancelButton.onClicked: {
- request.dialogReject();
- closeForm();
- }
-
- function createCallback(color) {
- return function() { colorPicker.color = color };
- }
-
- Component.onCompleted:{
- for (var i = 0; i < grid.children.length; i++) {
- var cell = grid.children[i];
- cell.clicked.connect(createCallback(cell.color));
- }
- colorPicker.color = request.color;
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/ColorPickerForm.ui.qml b/examples/webenginequick/customdialogs/forms/ColorPickerForm.ui.qml
deleted file mode 100644
index 060aeef7d..000000000
--- a/examples/webenginequick/customdialogs/forms/ColorPickerForm.ui.qml
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- property alias cancelButton: cancelButton
- property alias okButton: okButton
- property string message: "Message"
- property string title: "Title"
- property alias blue1: blue1
- property alias grid: grid
- property alias colorPicker: colorPicker
-
- ColumnLayout {
- id: columnLayout
- anchors.topMargin: 20
- anchors.top: parent.top
- anchors.bottomMargin: 20
- anchors.bottom: parent.bottom
- anchors.rightMargin: 20
- anchors.right: parent.right
- anchors.leftMargin: 20
- anchors.left: parent.left
-
- Image {
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- source: "qrc:/icon.svg"
- }
-
- Rectangle {
- width: parent.width
- height: 30
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#25a6e2"
- }
-
- GradientStop {
- color: "#188bd0"
- }
- }
-
- Text {
- id: title
- x: 54
- y: 5
- color: "#ffffff"
- text: qsTr("Select Color")
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- }
-
- Item {
- width: 40
- height: 40
- }
-
- GridLayout {
- id: grid
- columns: 5
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
-
- ColorCell {
- id: blue1
- color: "#26d5f8"
- }
- ColorCell {
- id: green1
- color: "#25f93d"
- }
- ColorCell {
- id: red1
- color: "#f71111"
- }
- ColorCell {
- id: yellow1
- color: "#faf23c"
- }
- ColorCell {
- id: orange1
- color: "#ec8505"
- }
- ColorCell {
- id: blue2
- color: "#037eaa"
- }
- ColorCell {
- id: green2
- color: "#389a13"
- }
- ColorCell {
- id: red2
- color: "#b2001b"
- }
- ColorCell {
- id: yellow2
- color: "#caca03"
- }
- ColorCell {
- id: orange2
- color: "#bb4900"
- }
- ColorCell {
- id: blue3
- color: "#01506c"
- }
- ColorCell {
- id: green3
- color: "#37592b"
- }
- ColorCell {
- id: red3
- color: "#700113"
- }
- ColorCell {
- id: yellow3
- color: "#848404"
- }
-
- ColorCell {
- id: orange3
- color: "#563100"
- }
- }
-
- Item {
- width: 10
- height: 10
- }
-
- Rectangle {
- width: 90
- height: 90
- color: "#000000"
- radius: 4
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
-
- Rectangle {
- id: colorPicker
- height: 80
- color: "#ffffff"
- anchors.rightMargin: 5
- anchors.leftMargin: 5
- anchors.bottomMargin: 5
- anchors.topMargin: 5
- anchors.fill: parent
- }
- }
-
- Item {
- Layout.fillHeight: true
- }
-
- RowLayout {
- id: rowLayout
- width: 100
- height: 100
-
- Item {
- Layout.fillWidth: true
- }
-
- CustomButton {
- id: cancelButton
- width: 90
- height: 30
- btnText: qsTr("Cancel")
- btnBlue: false
- }
-
- CustomButton {
- id: okButton
- width: 90
- height: 30
- btnText: qsTr("OK")
- btnBlue: false
- }
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/CustomButton.qml b/examples/webenginequick/customdialogs/forms/CustomButton.qml
deleted file mode 100644
index 00a06d558..000000000
--- a/examples/webenginequick/customdialogs/forms/CustomButton.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-Rectangle {
- id: root
- width: 200
- height: 30
- radius: 5
- property string btnText: "Name"
- property bool btnEnable: true
- property bool btnBlue: true
- opacity: btnEnable ? 1.0 : 0.5
- signal clicked()
- gradient: btnBlue ? blueButton : greenButton
- Text {
- id: textArea
- x: 54
- y: 5
- color: "#ffffff"
- text: parent.btnText
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- font.bold: false
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- if (btnEnable)
- root.clicked();
- }
- }
-
- Gradient {
- id: blueButton
- GradientStop {
- position: 0
- color: "#25a6e2"
- }
- GradientStop {
- position: mouseArea.pressed && root.btnEnable ? 0.7 :1
- color: "#188bd0"
- }
- }
-
- Gradient {
- id: greenButton
- GradientStop {
- position: 0
- color: "#80c342"
- }
- GradientStop {
- position: mouseArea.pressed && root.btnEnable ? 0.7 :1
- color: "#5fac18"
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/FilePicker.qml b/examples/webenginequick/customdialogs/forms/FilePicker.qml
deleted file mode 100644
index 45ffefb3a..000000000
--- a/examples/webenginequick/customdialogs/forms/FilePicker.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-FilePickerForm {
- property QtObject request
- property string selectedFile
- signal closeForm()
-
- cancelButton.onClicked: {
- request.dialogReject();
- closeForm();
- }
-
- okButton.onClicked: {
- request.dialogAccept('/' + selectedFile);
- closeForm();
- }
-
- function createCallback(fileIndex) {
- return function() {
- for (var i = 0; i < files.children.length; i++) {
- var file = files.children[i];
- if (i === fileIndex) {
- selectedFile = file.text;
- file.selected = true;
- } else {
- file.selected = false;
- }
- }
- }
- }
-
- Component.onCompleted: {
- selectedFile = request.defaultFileName;
- for (var i = 0; i < files.children.length; i++) {
- var file = files.children[i];
- file.clicked.connect(createCallback(i));
- if (file.text === selectedFile)
- file.selected = true;
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/FilePickerForm.ui.qml b/examples/webenginequick/customdialogs/forms/FilePickerForm.ui.qml
deleted file mode 100644
index 1e99b1a91..000000000
--- a/examples/webenginequick/customdialogs/forms/FilePickerForm.ui.qml
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- property alias cancelButton: cancelButton
- property alias okButton: okButton
- property string message: "Message"
- property string title: "Title"
- property alias files: files
-
- ColumnLayout {
- id: columnLayout
- anchors.topMargin: 20
- anchors.top: parent.top
- anchors.bottomMargin: 20
- anchors.bottom: parent.bottom
- anchors.rightMargin: 20
- anchors.right: parent.right
- anchors.leftMargin: 20
- anchors.left: parent.left
-
- Image {
- id: image
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- source: "qrc:/icon.svg"
- }
-
- Rectangle {
- id: rectangle
- width: parent.width
- height: 30
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#25a6e2"
- }
-
- GradientStop {
- color: "#188bd0"
- }
- }
-
- Text {
- id: title
- x: 54
- y: 5
- color: "#ffffff"
- text: qsTr("Select File")
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- }
-
- Item {
- width: 40
- height: 40
- }
-
- ColumnLayout {
- id: files
-
- FileRow {
- id: filename1
- text: "example.qdoc"
- }
-
- FileRow {
- id: filename2
- text: "factory.cpp"
- }
-
- FileRow {
- id: filename3
- text: "index.html"
- }
-
- FileRow {
- id: filename4
- text: "main.qml"
- }
-
- FileRow {
- id: filename5
- text: "qt-logo.png"
- }
-
- FileRow {
- id: filename6
- text: "window.h"
- }
- }
-
- Item {
- Layout.fillHeight: true
- }
-
- RowLayout {
- id: rowLayout
- width: 20
- height: 100
-
- Item {
- Layout.fillWidth: true
- }
-
- CustomButton {
- id: cancelButton
- width: 90
- height: 30
- btnText: qsTr("Cancel")
- btnBlue: false
- }
-
- CustomButton {
- id: okButton
- width: 90
- height: 30
- btnText: qsTr("OK")
- btnBlue: false
- }
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/FileRow.qml b/examples/webenginequick/customdialogs/forms/FileRow.qml
deleted file mode 100644
index 1a0cfc0a0..000000000
--- a/examples/webenginequick/customdialogs/forms/FileRow.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- id: root
- height: 30
- property string text: "Filename"
- property bool selected: false
- signal clicked()
-
- RowLayout {
- id: fileRow
- width: 100
-
- Item {
- id: item5
- width: 10
- height: 10
- }
-
- Rectangle {
- id: rectangle2
- width: 10
- height: 10
- color: selected ? "#80c342" : "#25a6e2"
- }
-
- Text {
- id: filename
- text: root.text
- font.pointSize: 12
- }
- }
-
- MouseArea {
- id: mouseArea
- width: 200
- height: 30
- onClicked: root.clicked()
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/JavaScript.qml b/examples/webenginequick/customdialogs/forms/JavaScript.qml
deleted file mode 100644
index 132c95697..000000000
--- a/examples/webenginequick/customdialogs/forms/JavaScript.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtWebEngine
-
-JavaScriptForm {
- property QtObject request
- signal closeForm()
-
- cancelButton.onClicked: {
- request.dialogReject();
- closeForm();
- }
-
- okButton.onClicked: {
- request.dialogAccept(prompt.text);
- closeForm();
- }
-
- Component.onCompleted: {
- switch (request.type) {
- case JavaScriptDialogRequest.DialogTypeAlert:
- cancelButton.visible = false;
- title = qsTr("Alert");
- message = request.message;
- prompt.text = "";
- prompt.visible = false;
- break;
- case JavaScriptDialogRequest.DialogTypeConfirm:
- title = qsTr("Confirm");
- message = request.message;
- prompt.text = "";
- prompt.visible = false;
- break;
- case JavaScriptDialogRequest.DialogTypePrompt:
- title = qsTr("Prompt");
- message = request.message;
- prompt.text = request.defaultText;
- prompt.visible = true;
- break;
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/JavaScriptForm.ui.qml b/examples/webenginequick/customdialogs/forms/JavaScriptForm.ui.qml
deleted file mode 100644
index b535e7ef9..000000000
--- a/examples/webenginequick/customdialogs/forms/JavaScriptForm.ui.qml
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-import QtQuick.Controls
-
-Item {
- id: root
- property alias cancelButton: cancelButton
- property alias okButton: okButton
- property string message: "Message"
- property string title: "Title"
- property alias prompt: prompt
-
- ColumnLayout {
- id: columnLayout
- anchors.topMargin: 20
- anchors.top: parent.top
- anchors.bottomMargin: 20
- anchors.bottom: parent.bottom
- anchors.rightMargin: 20
- anchors.right: parent.right
- anchors.leftMargin: 20
- anchors.left: parent.left
-
- Image {
- id: image
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- source: "qrc:/icon.svg"
- }
-
- Rectangle {
- id: rectangle
- width: parent.width
- height: 30
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#25a6e2"
- }
-
- GradientStop {
- color: "#188bd0"
- }
- }
-
- Text {
- id: title
- x: 54
- y: 5
- color: "#ffffff"
- text: qsTr("Title")
- font.pointSize: 12
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- }
- }
-
- Item {
- width: 40
- height: 40
- }
-
- Text {
- id: message
- text: root.message
- font.pointSize: 12
- }
-
- TextField {
- id: prompt
- width: 300
- height: 22
- Layout.fillWidth: true
- font.pointSize: 12
- color: "black"
-
- background: Rectangle {
- color: "white"
- border.color: "black"
- border.width: 1
- }
- }
-
- Item {
- Layout.fillHeight: true
- }
-
- RowLayout {
- id: rowLayout
- width: 100
- height: 100
-
- Item {
- Layout.fillWidth: true
- }
-
- CustomButton {
- id: cancelButton
- width: 90
- height: 30
- btnText: qsTr("Cancel")
- btnBlue: false
- }
-
- CustomButton {
- id: okButton
- width: 90
- height: 30
- btnText: qsTr("OK")
- btnBlue: false
- }
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/Menu.qml b/examples/webenginequick/customdialogs/forms/Menu.qml
deleted file mode 100644
index b90802a0c..000000000
--- a/examples/webenginequick/customdialogs/forms/Menu.qml
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-MenuForm {
- property QtObject request
- signal closeForm()
-
- followLink.onClicked: closeForm()
- back.onClicked: closeForm()
- forward.onClicked: closeForm()
- reload.onClicked: closeForm()
- copyLinkUrl.onClicked: closeForm()
- saveLink.onClicked: closeForm()
- close.onClicked: closeForm()
-
- Component.onCompleted: {
- back.btnEnable = false;
- forward.btnEnable = false;
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/MenuForm.ui.qml b/examples/webenginequick/customdialogs/forms/MenuForm.ui.qml
deleted file mode 100644
index b4c06bb7d..000000000
--- a/examples/webenginequick/customdialogs/forms/MenuForm.ui.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- property alias followLink: followLink
- property alias back: back
- property alias forward: forward
- property alias reload: reload
- property alias copyLinkUrl: copyLinkUrl
- property alias saveLink: saveLink
- property alias close: close
-
- ColumnLayout {
- id: columnLayout
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
-
- Image {
- id: image
- width: 100
- height: 100
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- source: "qrc:/icon.svg"
- }
-
- CustomButton {
- id: followLink
- btnText: qsTr("Follow")
- }
-
- CustomButton {
- id: back
- btnText: qsTr("Back")
- }
-
- CustomButton {
- id: forward
- btnText: qsTr("Forward")
- }
-
- CustomButton {
- id: reload
- btnText: qsTr("Reload")
- }
-
- CustomButton {
- id: copyLinkUrl
- btnText: qsTr("Copy Link URL")
- }
-
- CustomButton {
- id: saveLink
- btnText: qsTr("Save Link")
- }
-
- CustomButton {
- id: close
- btnBlue: false
- btnText: qsTr("Close")
- }
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/TouchSelectionMenu.qml b/examples/webenginequick/customdialogs/forms/TouchSelectionMenu.qml
deleted file mode 100644
index 1b0c19789..000000000
--- a/examples/webenginequick/customdialogs/forms/TouchSelectionMenu.qml
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-
-TouchSelectionMenuForm {
- property QtObject request
- signal closeForm()
-
- cut.onClicked: closeForm()
- copy.onClicked: closeForm()
- paste.onClicked: closeForm()
- contextMenu.onClicked: closeForm()
-}
diff --git a/examples/webenginequick/customdialogs/forms/TouchSelectionMenuForm.ui.qml b/examples/webenginequick/customdialogs/forms/TouchSelectionMenuForm.ui.qml
deleted file mode 100644
index bed39566f..000000000
--- a/examples/webenginequick/customdialogs/forms/TouchSelectionMenuForm.ui.qml
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Layouts
-
-Item {
- property alias cut: cut
- property alias copy: copy
- property alias paste: paste
- property alias contextMenu: contextMenu
-
- ColumnLayout {
- id: columnLayout
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
-
- CustomButton {
- id: cut
- btnText: qsTr("Cut")
- }
-
- CustomButton {
- id: copy
- btnText: qsTr("Copy")
- }
-
- CustomButton {
- id: paste
- btnText: qsTr("Paste")
- }
-
- CustomButton {
- id: contextMenu
- btnText: qsTr("...")
- }
-
- }
-}
diff --git a/examples/webenginequick/customdialogs/forms/forms.qmlproject b/examples/webenginequick/customdialogs/forms/forms.qmlproject
deleted file mode 100644
index b06afaaf1..000000000
--- a/examples/webenginequick/customdialogs/forms/forms.qmlproject
+++ /dev/null
@@ -1,45 +0,0 @@
-import QmlProject
-
-Project {
- mainFile: "MenuForm.ui.qml"
-
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
-
- JavaScriptFiles {
- directory: "."
- }
-
- ImageFiles {
- directory: "."
- }
-
- Files {
- filter: "*.conf"
- files: ["qtquickcontrols2.conf"]
- }
-
- Files {
- filter: "qmldir"
- directory: "."
- }
-
- Files {
- filter: "*.ttf;*.otf"
- }
-
- Environment {
- QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
- QT_AUTO_SCREEN_SCALE_FACTOR: "1"
- }
-
- qt6Project: true
-
- /* List of plugin directories passed to QML runtime */
- importPaths: [ ".", "imports" ]
-
- /* Required for deployment */
- targetDirectory: "/opt/forms"
-}
diff --git a/examples/webenginequick/customdialogs/icon.svg b/examples/webenginequick/customdialogs/icon.svg
deleted file mode 100644
index 48271180b..000000000
--- a/examples/webenginequick/customdialogs/icon.svg
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="94px" height="94px" viewBox="0 0 94 94" enable-background="new 0 0 94 94" xml:space="preserve">
-<g>
- <circle fill="none" cx="47" cy="47" r="47"/>
- <g>
- <path fill="#46A2DA" d="M47,92.979c-11.779,0-23.559-4.484-32.526-13.451C-3.461,61.591-3.461,32.409,14.472,14.474
- C32.41-3.463,61.592-3.461,79.526,14.473c17.935,17.936,17.935,47.119,0.002,65.054l-0.002,0.001
- C70.559,88.495,58.779,92.979,47,92.979z"/>
- </g>
- <path fill="#80C342" d="M93,47C93,21.595,72.405,1,47,1C34.297,1,22.797,6.149,14.473,14.473l65.054,65.054
- C87.851,71.203,93,59.703,93,47z"/>
- <g>
- <path fill="#46A2DA" d="M47,65c-4.808,0-9.328-1.873-12.728-5.272c-7.018-7.019-7.018-18.438,0-25.456
- C37.672,30.873,42.192,29,47,29s9.328,1.873,12.728,5.272c7.018,7.019,7.018,18.438,0,25.456C56.328,63.127,51.808,65,47,65z"/>
- <path fill="#FFFFFF" d="M62.248,59.919c6.671-7.858,6.312-19.644-1.105-27.061C57.237,28.953,52.118,27,47,27
- c-5.118,0-10.237,1.953-14.142,5.858c-7.81,7.81-7.81,20.474,0,28.284C36.763,65.047,41.882,67,47,67
- c4.379,0,8.752-1.441,12.372-4.3L77.88,81.209c0.989-0.895,1.935-1.837,2.843-2.814L62.248,59.919z M35.686,58.314
- c-6.238-6.238-6.238-16.389,0-22.627C38.708,32.664,42.726,31,47,31c4.274,0,8.292,1.664,11.314,4.686
- c6.238,6.238,6.238,16.389,0,22.627C55.292,61.336,51.274,63,47,63C42.726,63,38.708,61.336,35.686,58.314z"/>
- </g>
-</g>
-</svg>
diff --git a/examples/webenginequick/customdialogs/index.html b/examples/webenginequick/customdialogs/index.html
deleted file mode 100644
index d5de2827c..000000000
--- a/examples/webenginequick/customdialogs/index.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Custom UI</title>
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- <body>
- <table align="center">
- <tr>
- <td><div class="div"><a href="#openMenu" class="link">Right click on text to see link context menu</a></div></td>
- </tr>
- <tr>
- <td><div class="div"><p title="I am a tooltip.">Hover this text to display a tooltip</a></div></td>
- </tr>
- <tr>
- <td><div class="div"><p>Touch devices only: long press on this text to see the touch selection menu</p></div></td>
- </tr>
- <tr>
- <td><button class="button" onclick="window.location = 'http://localhost.:5555/OPEN_AUTH'">
- Open Authentication Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="window.location = 'http://www.qt.io'">
- Open Proxy Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="alert('This is the Alert Dialog !')">
- Open Alert Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="confirm('This is the Confirm Dialog.')">
- Open Confirm Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="prompt('Is this the Prompt Dialog ?', 'Yes')">
- Open Prompt Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="document.getElementById('colorpicker').click()">
- Open Color Dialog</button></td>
- </tr>
- <tr>
- <td><button class="button" onclick="document.getElementById('filepicker').click()">
- Open File Dialog</button></td>
- </tr>
- </table>
- <input type="color" id="colorpicker" value="#ff0000" style="visibility:hidden"/>
- <input type="file" id="filepicker" accept=".cpp, .html, .h, .png, .qdoc, .qml" style="visibility:hidden"/>
- </body>
-</html>
diff --git a/examples/webenginequick/customdialogs/main.cpp b/examples/webenginequick/customdialogs/main.cpp
deleted file mode 100644
index c114ea935..000000000
--- a/examples/webenginequick/customdialogs/main.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "server.h"
-#include <QtWebEngineQuick/qtwebenginequickglobal.h>
-#include <QNetworkProxy>
-#include <QQmlApplicationEngine>
-#include <QTimer>
-#include <QtGui/QGuiApplication>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication::setOrganizationName("QtExamples");
- QtWebEngineQuick::initialize();
-
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- Server *server = new Server(&engine);
-
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- QTimer::singleShot(0, server, &Server::run);
-
- QNetworkProxy proxy;
- proxy.setType(QNetworkProxy::HttpProxy);
- proxy.setHostName("localhost");
- proxy.setPort(5555);
- QNetworkProxy::setApplicationProxy(proxy);
-
- return app.exec();
-}
-
diff --git a/examples/webenginequick/customdialogs/main.qml b/examples/webenginequick/customdialogs/main.qml
deleted file mode 100644
index d0cb6f324..000000000
--- a/examples/webenginequick/customdialogs/main.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtQuick.Window
-
-Window {
- id: mainWindow
- width: 800
- height: 610
- visible: true
-
- StackView {
- id: stackView
- anchors.fill: parent
- focus: true
- initialItem: Item {
- id: main
- width: mainWindow.width
- height: mainWindow.height
- ColumnLayout {
- anchors.fill: parent
- SwitchButton {
- id: switcher
- Layout.fillWidth: true
- }
- WebView {
- id: webView
- useDefaultDialogs: switcher.checked
- Layout.fillWidth: true
- Layout.fillHeight: true
- }
- }
- }
-
- function closeForm()
- {
- pop(main);
- // reset url in case of proxy error
- webView.url = "qrc:/index.html"
- }
-
- function openForm(form)
- {
- push(form.item, form.properties);
- currentItem.closeForm.connect(closeForm);
- }
-
- }
-
- Component.onCompleted: {
- webView.openForm.connect(stackView.openForm);
- }
-}
diff --git a/examples/webenginequick/customdialogs/server.cpp b/examples/webenginequick/customdialogs/server.cpp
deleted file mode 100644
index efb870618..000000000
--- a/examples/webenginequick/customdialogs/server.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "server.h"
-#include <QDataStream>
-#include <QTcpSocket>
-
-Server::Server(QObject *parent) : QObject(parent)
-{
- connect(&m_server, &QTcpServer::newConnection, this, &Server::handleNewConnection);
-}
-
-void Server::run()
-{
- if (!m_server.listen(QHostAddress::LocalHost, 5555))
- qWarning() << "Could not start the server -> http/proxy authentication dialog"
- " will not work. Error:" << m_server.errorString();
-}
-
-void Server::handleNewConnection()
-{
- QTcpSocket *socket = m_server.nextPendingConnection();
- connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater);
- connect(socket, &QAbstractSocket::readyRead, this, &Server::handleReadReady);
-}
-
-void Server::handleReadReady()
-{
- QTcpSocket *socket = qobject_cast<QTcpSocket*>(sender());
- Q_ASSERT(socket);
- m_data.append(socket->readAll());
-
- // simply wait for whole request
- if (!m_data.endsWith("\r\n\r\n"))
- return;
- if (m_data.contains(QByteArrayLiteral("OPEN_AUTH"))) {
- socket->write("HTTP/1.1 401 Unauthorized\nWWW-Authenticate: "
- "Basic realm=\"Very Restricted Area\"\r\n\r\n");
- m_data.clear();
- return;
- }
-
- socket->write("HTTP/1.1 407 Proxy Auth Required\nProxy-Authenticate: "
- "Basic realm=\"Proxy requires authentication\"\r\n"
- "content-length: 0\r\n\r\n");
- m_data.clear();
-}
diff --git a/examples/webenginequick/customdialogs/server.h b/examples/webenginequick/customdialogs/server.h
deleted file mode 100644
index 563465013..000000000
--- a/examples/webenginequick/customdialogs/server.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef SERVER_H
-#define SERVER_H
-
-#include <QObject>
-#include <QTcpServer>
-
-class Server : public QObject
-{
- Q_OBJECT
-
-public:
- explicit Server(QObject *parent = nullptr);
-
-public slots:
- void run();
-
-private slots:
- void handleNewConnection();
- void handleReadReady();
-
-private:
- QTcpServer m_server;
- QByteArray m_data;
-};
-
-#endif // SERVER_H
diff --git a/examples/webenginequick/customdialogs/style.css b/examples/webenginequick/customdialogs/style.css
deleted file mode 100644
index e4c25e7eb..000000000
--- a/examples/webenginequick/customdialogs/style.css
+++ /dev/null
@@ -1,37 +0,0 @@
-.div {
- padding:8px 4px;
- border: 5px solid #188BD0;
- width: 280px;
- font-family: sans-serif;
- font-size:10pt;
-}
-.link {
- text-decoration: none;
- color: #888888;
-}
-.button {
- background: -webkit-linear-gradient(top,#25A6E2 0%,#188BD0 100%);
- padding:8px 13px;
- color:#fff;
- font-family: sans-serif;
- font-size:17px;
- -webkit-border-radius:5px;
- border:1px solid #1A87FF;
- width: 300px;
-}
-.button:focus {
- outline: none;
-}
-.button:active {
- background: -webkit-linear-gradient(top,#25A6E2 0%,#188BD0 70%);
-}
-.input {
- padding:8px 4px;
- border: 5px solid #188BD0;
- width: 280px;
- font-family: sans-serif;
- font-size:10pt;
-}
-.input:focus {
- outline: none;
-}
diff --git a/examples/webenginequick/webenginequick.pro b/examples/webenginequick/webenginequick.pro
index 6a0a858d6..8c7343017 100644
--- a/examples/webenginequick/webenginequick.pro
+++ b/examples/webenginequick/webenginequick.pro
@@ -1,7 +1,6 @@
TEMPLATE=subdirs
SUBDIRS += \
- customdialogs \
customtouchhandle \
quicknanobrowser \
webengineaction