From b71403faeedf2955e3af541f9e140305af9ba0a8 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 20 Mar 2023 08:46:13 +0100 Subject: 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 (cherry picked from commit 6bf30525ee49d270dae6a6440bc607513f21237c) Reviewed-by: Qt Cherry-pick Bot --- examples/webenginequick/CMakeLists.txt | 1 - .../webenginequick/customdialogs/CMakeLists.txt | 76 ----- .../customdialogs/MessageRectangle.qml | 18 -- .../webenginequick/customdialogs/SwitchButton.qml | 23 -- examples/webenginequick/customdialogs/WebView.qml | 117 -------- .../webenginequick/customdialogs/customdialogs.pro | 18 -- .../webenginequick/customdialogs/customdialogs.qrc | 24 -- .../doc/images/customdialogs-auth1.png | Bin 18549 -> 0 bytes .../doc/images/customdialogs-auth2.png | Bin 5064 -> 0 bytes .../doc/images/customdialogs-color1.png | Bin 9729 -> 0 bytes .../doc/images/customdialogs-color2.png | Bin 3952 -> 0 bytes .../doc/images/customdialogs-file1.png | Bin 18540 -> 0 bytes .../doc/images/customdialogs-file2.png | Bin 6773 -> 0 bytes .../doc/images/customdialogs-menu.png | Bin 5484 -> 0 bytes .../doc/images/customdialogs-prompt1.png | Bin 14845 -> 0 bytes .../doc/images/customdialogs-prompt2.png | Bin 4764 -> 0 bytes .../doc/images/customdialogs-tooltip.png | Bin 1617 -> 0 bytes .../customdialogs/doc/images/customdialogs.png | Bin 9093 -> 0 bytes .../customdialogs/doc/src/customdialogs.qdoc | 309 --------------------- .../customdialogs/forms/Authentication.qml | 31 --- .../customdialogs/forms/AuthenticationForm.ui.qml | 137 --------- .../customdialogs/forms/ColorCell.qml | 16 -- .../customdialogs/forms/ColorPicker.qml | 31 --- .../customdialogs/forms/ColorPickerForm.ui.qml | 186 ------------- .../customdialogs/forms/CustomButton.qml | 61 ---- .../customdialogs/forms/FilePicker.qml | 44 --- .../customdialogs/forms/FilePickerForm.ui.qml | 128 --------- .../webenginequick/customdialogs/forms/FileRow.qml | 44 --- .../customdialogs/forms/JavaScript.qml | 44 --- .../customdialogs/forms/JavaScriptForm.ui.qml | 117 -------- .../webenginequick/customdialogs/forms/Menu.qml | 22 -- .../customdialogs/forms/MenuForm.ui.qml | 65 ----- .../customdialogs/forms/TouchSelectionMenu.qml | 14 - .../forms/TouchSelectionMenuForm.ui.qml | 39 --- .../customdialogs/forms/forms.qmlproject | 45 --- examples/webenginequick/customdialogs/icon.svg | 24 -- examples/webenginequick/customdialogs/index.html | 51 ---- examples/webenginequick/customdialogs/main.cpp | 32 --- examples/webenginequick/customdialogs/main.qml | 56 ---- examples/webenginequick/customdialogs/server.cpp | 47 ---- examples/webenginequick/customdialogs/server.h | 29 -- examples/webenginequick/customdialogs/style.css | 37 --- examples/webenginequick/webenginequick.pro | 1 - 43 files changed, 1887 deletions(-) delete mode 100644 examples/webenginequick/customdialogs/CMakeLists.txt delete mode 100644 examples/webenginequick/customdialogs/MessageRectangle.qml delete mode 100644 examples/webenginequick/customdialogs/SwitchButton.qml delete mode 100644 examples/webenginequick/customdialogs/WebView.qml delete mode 100644 examples/webenginequick/customdialogs/customdialogs.pro delete mode 100644 examples/webenginequick/customdialogs/customdialogs.qrc delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-color1.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-color2.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-file1.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-file2.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-menu.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.png delete mode 100644 examples/webenginequick/customdialogs/doc/images/customdialogs.png delete mode 100644 examples/webenginequick/customdialogs/doc/src/customdialogs.qdoc delete mode 100644 examples/webenginequick/customdialogs/forms/Authentication.qml delete mode 100644 examples/webenginequick/customdialogs/forms/AuthenticationForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/ColorCell.qml delete mode 100644 examples/webenginequick/customdialogs/forms/ColorPicker.qml delete mode 100644 examples/webenginequick/customdialogs/forms/ColorPickerForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/CustomButton.qml delete mode 100644 examples/webenginequick/customdialogs/forms/FilePicker.qml delete mode 100644 examples/webenginequick/customdialogs/forms/FilePickerForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/FileRow.qml delete mode 100644 examples/webenginequick/customdialogs/forms/JavaScript.qml delete mode 100644 examples/webenginequick/customdialogs/forms/JavaScriptForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/Menu.qml delete mode 100644 examples/webenginequick/customdialogs/forms/MenuForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/TouchSelectionMenu.qml delete mode 100644 examples/webenginequick/customdialogs/forms/TouchSelectionMenuForm.ui.qml delete mode 100644 examples/webenginequick/customdialogs/forms/forms.qmlproject delete mode 100644 examples/webenginequick/customdialogs/icon.svg delete mode 100644 examples/webenginequick/customdialogs/index.html delete mode 100644 examples/webenginequick/customdialogs/main.cpp delete mode 100644 examples/webenginequick/customdialogs/main.qml delete mode 100644 examples/webenginequick/customdialogs/server.cpp delete mode 100644 examples/webenginequick/customdialogs/server.h delete mode 100644 examples/webenginequick/customdialogs/style.css (limited to 'examples') 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 @@ - - - forms/AuthenticationForm.ui.qml - forms/Authentication.qml - forms/ColorCell.qml - forms/ColorPickerForm.ui.qml - forms/ColorPicker.qml - forms/CustomButton.qml - forms/FilePickerForm.ui.qml - forms/FilePicker.qml - forms/FileRow.qml - forms/JavaScriptForm.ui.qml - forms/JavaScript.qml - forms/MenuForm.ui.qml - forms/Menu.qml - icon.svg - index.html - main.qml - MessageRectangle.qml - style.css - SwitchButton.qml - WebView.qml - - 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth1.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-auth2.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-color1.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-color2.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-file1.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-file2.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-menu.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt1.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-prompt2.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs-tooltip.png and /dev/null 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 Binary files a/examples/webenginequick/customdialogs/doc/images/customdialogs.png and /dev/null 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 @@ - - - - - - - - - - - - - - - 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 @@ - - - - - Custom UI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Hover this text to display a tooltip

Touch devices only: long press on this text to see the touch selection menu

- - - - 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 -#include -#include -#include -#include - -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 -#include - -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(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 -#include - -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 -- cgit v1.2.1