diff options
Diffstat (limited to 'examples/webenginequick/webengineaction')
-rw-r--r-- | examples/webenginequick/webengineaction/CMakeLists.txt | 45 | ||||
-rw-r--r-- | examples/webenginequick/webengineaction/doc/images/webengineaction-example.png | bin | 100266 -> 0 bytes | |||
-rw-r--r-- | examples/webenginequick/webengineaction/doc/src/webengineaction.qdoc | 44 | ||||
-rw-r--r-- | examples/webenginequick/webengineaction/main.cpp | 19 | ||||
-rw-r--r-- | examples/webenginequick/webengineaction/main.qml | 119 | ||||
-rw-r--r-- | examples/webenginequick/webengineaction/qml.qrc | 5 | ||||
-rw-r--r-- | examples/webenginequick/webengineaction/webengineaction.pro | 10 |
7 files changed, 0 insertions, 242 deletions
diff --git a/examples/webenginequick/webengineaction/CMakeLists.txt b/examples/webenginequick/webengineaction/CMakeLists.txt deleted file mode 100644 index 1d6ae3fe5..000000000 --- a/examples/webenginequick/webengineaction/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(webengineaction LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginequick/webengineaction") - -find_package(Qt6 REQUIRED COMPONENTS Core Gui WebEngineQuick) - -qt_add_executable(webengineaction - main.cpp -) - -set_target_properties(webengineaction PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(webengineaction PUBLIC - Qt::Core - Qt::Gui - Qt::WebEngineQuick -) - -# Resources: -set(qml_resource_files - "main.qml" -) - -qt_add_resources(webengineaction "qml" - PREFIX - "/" - FILES - ${qml_resource_files} -) - -install(TARGETS webengineaction - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/webenginequick/webengineaction/doc/images/webengineaction-example.png b/examples/webenginequick/webengineaction/doc/images/webengineaction-example.png Binary files differdeleted file mode 100644 index 2e34bbf63..000000000 --- a/examples/webenginequick/webengineaction/doc/images/webengineaction-example.png +++ /dev/null diff --git a/examples/webenginequick/webengineaction/doc/src/webengineaction.qdoc b/examples/webenginequick/webengineaction/doc/src/webengineaction.qdoc deleted file mode 100644 index 24394ad04..000000000 --- a/examples/webenginequick/webengineaction/doc/src/webengineaction.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only - -/*! - \example webenginequick/webengineaction - \title WebEngine Action Example - \ingroup webengine-examples - \brief A simple browser implemented using WebEngineActions. - - \image webengineaction-example.png - - \e {WebEngine Action Example} demonstrates how to perform actions on a web page - using the \l{WebEngineAction} type. It shows the minimum amount of code needed - to bind browser functionalities to input elements and build up a custom context - menu. - - \include examples-run.qdocinc - - \section1 Working With Web Engine Actions - - An intended use of \l{WebEngineAction} is building a connection between UI - elements and browser commands. It can be added to menus and toolbars via - assigning its properties to the corresponding ones of the element. - - The \l{ToolButton} relies on the properties provided by a - \l{WebEngineAction}. Clicking the button triggers backwards navigation on the - originating \l{WebEngineView} of the action. - - \quotefromfile webenginequick/webengineaction/main.qml - \skipto ToolButton { - \printuntil } - - The simplest way to create custom context menus is enumerating the required - \l{WebEngineAction} types in a data model and instantiating \l{MenuItem} types - for them, for example using a \l{Repeater}. - - \quotefromfile webenginequick/webengineaction/main.qml - \skipto property Menu contextMenu: Menu { - \printuntil /^ {8}\}/ - - Assigning a \l{WebEngineAction} to multiple UI elements will keep them in sync. - As it can be seen in the picture above, if the browser engine disables a - navigation action, both corresponding menu items will be disabled. -*/ diff --git a/examples/webenginequick/webengineaction/main.cpp b/examples/webenginequick/webengineaction/main.cpp deleted file mode 100644 index e685a715c..000000000 --- a/examples/webenginequick/webengineaction/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QtWebEngineQuick/qtwebenginequickglobal.h> - -int main(int argc, char *argv[]) -{ - QCoreApplication::setOrganizationName("QtExamples"); - QtWebEngineQuick::initialize(); - - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/examples/webenginequick/webengineaction/main.qml b/examples/webenginequick/webengineaction/main.qml deleted file mode 100644 index 149484340..000000000 --- a/examples/webenginequick/webengineaction/main.qml +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import QtQuick -import QtQuick.Window -import QtWebEngine -import QtQuick.Controls -import QtQuick.Layouts - -ApplicationWindow { - id: window - visible: true - width: 800 - height: 600 - title: qsTr("WebEngineAction Example") - - header: ToolBar { - RowLayout { - anchors.fill: parent - - ToolButton { - property int itemAction: WebEngineView.Back - text: webEngineView.action(itemAction).text - enabled: webEngineView.action(itemAction).enabled - onClicked: webEngineView.action(itemAction).trigger() - icon.name: webEngineView.action(itemAction).iconName - display: AbstractButton.TextUnderIcon - } - - ToolButton { - property int itemAction: WebEngineView.Forward - text: webEngineView.action(itemAction).text - enabled: webEngineView.action(itemAction).enabled - onClicked: webEngineView.action(itemAction).trigger() - icon.name: webEngineView.action(itemAction).iconName - display: AbstractButton.TextUnderIcon - } - - ToolButton { - property int itemAction: webEngineView.loading ? WebEngineView.Stop : WebEngineView.Reload - text: webEngineView.action(itemAction).text - enabled: webEngineView.action(itemAction).enabled - onClicked: webEngineView.action(itemAction).trigger() - icon.name: webEngineView.action(itemAction).iconName - display: AbstractButton.TextUnderIcon - } - - TextField { - Layout.fillWidth: true - - text: webEngineView.url - selectByMouse: true - onEditingFinished: webEngineView.url = text - } - - ToolButton { - id: settingsButton - text: "Settings" - icon.name: "settings-configure" - display: AbstractButton.TextUnderIcon - onClicked: settingsMenu.open() - checked: settingsMenu.visible - - Menu { - id: settingsMenu - y: settingsButton.height - - MenuItem { - id: customContextMenuOption - checkable: true - checked: true - - text: "Custom context menu" - } - } - } - } - } - - WebEngineView { - id: webEngineView - url: "https://qt.io" - anchors.fill: parent - - Component.onCompleted: { - profile.downloadRequested.connect(function(download){ - download.accept(); - }) - } - - property Menu contextMenu: Menu { - Repeater { - model: [ - WebEngineView.Back, - WebEngineView.Forward, - WebEngineView.Reload, - WebEngineView.SavePage, - WebEngineView.Copy, - WebEngineView.Paste, - WebEngineView.Cut - ] - MenuItem { - text: webEngineView.action(modelData).text - enabled: webEngineView.action(modelData).enabled - onClicked: webEngineView.action(modelData).trigger() - icon.name: webEngineView.action(modelData).iconName - display: MenuItem.TextBesideIcon - } - } - } - - onContextMenuRequested: function(request) { - if (customContextMenuOption.checked) { - request.accepted = true; - contextMenu.popup(); - } - } - } -} diff --git a/examples/webenginequick/webengineaction/qml.qrc b/examples/webenginequick/webengineaction/qml.qrc deleted file mode 100644 index 5f6483ac3..000000000 --- a/examples/webenginequick/webengineaction/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/webenginequick/webengineaction/webengineaction.pro b/examples/webenginequick/webengineaction/webengineaction.pro deleted file mode 100644 index 7ef0a8bcf..000000000 --- a/examples/webenginequick/webengineaction/webengineaction.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app - -QT += webenginequick - -SOURCES += main.cpp - -RESOURCES += qml.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/webenginequick/webengineaction -INSTALLS += target |