blob: 36317c176aebe76b8aafa3f90a2215f155a91c3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtTest
import QtWebEngine
WebEngineView {
id: webEngineView
width: 200
height: 200
url: Qt.resolvedUrl("qrc:/geolocation.html")
property bool deniedGeolocation: false
property bool geoPermissionRequested: false
onFeaturePermissionRequested: function(securityOrigin, feature) {
if (feature === WebEngineView.Geolocation) {
geoPermissionRequested = true
if (deniedGeolocation) {
webEngineView.grantFeaturePermission(securityOrigin, feature, false)
}
else {
webEngineView.grantFeaturePermission(securityOrigin, feature, true)
}
}
}
}
|