summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/code/src_gui_util_qdesktopservices.cpp
blob: 13deb88bc88263cf8a1fd07eb798acc1832ecfff (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QDesktopServices>
#include <QObject>
#include <QStandardPaths>
#include <QUrl>

namespace src_gui_util_qdesktopservices {

//! [0]
class MyHelpHandler : public QObject
{
    Q_OBJECT
public:
    // ...
public slots:
    void showHelp(const QUrl &url);
};
//! [0]

void wrapper0() {
MyHelpHandler *helpInstance = nullptr;
//! [setUrlHandler]
QDesktopServices::setUrlHandler("help", helpInstance, "showHelp");
//! [setUrlHandler]
} // wrapper


/* comment wrapper 1

//! [1]
mailto:user@foo.com?subject=Test&body=Just a test
//! [1]

*/ // comment wrapper 1


void wrapper1() {
//! [2]
QDesktopServices::openUrl(QUrl("file:///C:/Program Files", QUrl::TolerantMode));
//! [2]
}


/* comment wrapper 2

//! [3]
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>https</string>
</array>
//! [3]

//! [4]
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myapp</string>
        </array>
    </dict>
</array>
//! [4]

*/ // comment wrapper 2

/* comment wrapper 3
//! [7]
<key>com.apple.developer.associated-domains</key>
<array>
    <string>applinks:your.domain.com</string>
</array>
//! [7]

//! [8]
{
    "applinks": {
        "apps": [],
        "details": [{
            "appIDs" : [ "ABCDE12345.com.example.app" ],
            "components": [{
                "/": "/help",
                "?": { "topic": "?*"}
            }]
        }]
    }
}
//! [8]

//! [9]
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="your.domain.com" android:port="1337" android:path="/help"/>
</intent-filter>
//! [9]

//! [10]
<intent-filter android:autoVerify="true">
//! [10]

//! [11]
[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example.app",
    "sha256_cert_fingerprints":
    ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
  }
}]
//! [11]

*/ // comment wrapper 3

} // src_gui_util_qdesktopservices