diff options
Diffstat (limited to 'examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc')
-rw-r--r-- | examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc | 95 |
1 files changed, 66 insertions, 29 deletions
diff --git a/examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc b/examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc index 3b9af68b2..1e00402ff 100644 --- a/examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc +++ b/examples/webenginequick/quicknanobrowser/doc/src/quicknanobrowser.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \example webenginequick/quicknanobrowser @@ -32,6 +8,8 @@ \brief A web browser implemented using the WebEngineView QML type. \image quicknanobrowser-demo.jpg + \examplecategory {Application Examples} + \examplecategory {Web Technologies} \e {Quick Nano Browser} demonstrates how to use the \l{Qt WebEngine QML Types} {Qt WebEngine QML types} to develop a small web browser application that consists of a browser @@ -97,13 +75,16 @@ \section1 Handling Certificate Errors - If the certificate of the site being loaded triggers a certificate error, we call the - \l{WebEngineCertificateError::}{defer()} QML method to pause the URL request and wait for user - input: + In case of a certificate error, we check whether it came from the main frame, or from a + resource inside the page. Resource errors automatically trigger a certificate rejection, + since a user won't have enough context to make a decision. + For all other cases, we call the \l{WebEngineCertificateError::}{defer()} QML method to pause + the URL request and wait for user input: \quotefromfile webenginequick/quicknanobrowser/BrowserWindow.qml \skipto onCertificateError \printuntil } + \printuntil } We use the Dialog type to prompt users to continue or cancel the loading of the web page. If users select \uicontrol Yes, we call the @@ -115,6 +96,31 @@ \skipto Dialog { \printuntil /^\ {4}\}/ + \section1 Handling Feature Permission Requests + + We use the \c onFeaturePermissionRequested() signal handler to handle requests for + accessing a certain feature or device. The \c securityOrigin parameter identifies the + requester web site, and the \c feature parameter is the requested feature. We use these + to construct the message of the dialog: + + \quotefromfile webenginequick/quicknanobrowser/BrowserWindow.qml + \skipto onFeaturePermissionRequested + \printuntil } + + We show a dialog where the user is asked to grant or deny access. The custom + \c questionForFeature() JavaScript function generates a human-readable question about + the request. + If users select \uicontrol Yes, we call the \l{WebEngineView::}{grantFeaturePermission()} + method with a third \c true parameter to grant the \c securityOrigin web site the permission + to access the \c feature. + If users select \uicontrol No, we call the same method but with the \c false parameter to + deny access: + + \skipto id: sslDialog + \skipto Dialog { + \printuntil /^\ {4}\}/ + + \section1 Entering and Leaving Fullscreen Mode We create a menu item for allowing fullscreen mode in a settings menu that we place on the tool @@ -141,6 +147,37 @@ \skipto Escape \printuntil /^\ {4}\}/ + \section1 Handling WebAuth/FIDO UX Requests + + We use the \c onWebAuthUxRequested() signal handler to handle requests for + WebAuth/FIDO UX. The \c request parameter is an instance of WebEngineWebAuthUxRequest + which contains UX request details and APIs required to process the request. + We use it to construct WebAuthUX dialog and initiates the UX request flow. + + \quotefromfile webenginequick/quicknanobrowser/BrowserWindow.qml + \skipto onWebAuthUxRequested + \printuntil } + + The \l WebEngineWebAuthUxRequest object periodically emits the \l + {WebEngineWebAuthUxRequest::}{stateChanged} signal to notify potential + observers of the current WebAuth UX states. The observers update the WebAuth + dialog accordingly. We use onStateChanged() signal handler to handle + state change requests. See \c WebAuthDialog.qml for an example + of how these signals can be handled. + + \quotefromfile webenginequick/quicknanobrowser/WebAuthDialog.qml + \skipto Connections + \printuntil } + \skipto function init(request) + \printuntil } + + \section1 Signing Requirement for macOS + + To allow web sites access to the location, camera, and microphone when running + \e {Quick Nano Browser} on macOS, the application needs to be signed. This is + done automatically when building, but you need to set up a valid signing identity + for the build environment. + \section1 Files and Attributions The example uses icons from the Tango Icon Library: |