Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_util_qdesktopservices.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QDesktopServices>
4#include <QObject>
5#include <QStandardPaths>
6#include <QUrl>
7
9
11class MyHelpHandler : public QObject
12{
14public:
15 // ...
16public slots:
17 void showHelp(const QUrl &url);
18};
20
21void wrapper0() {
22MyHelpHandler *helpInstance = nullptr;
24QDesktopServices::setUrlHandler("help", helpInstance, "showHelp");
26} // wrapper
27
28
29/* comment wrapper 1
30
32mailto:user@foo.com?subject=Test&body=Just a test
34
35*/ // comment wrapper 1
36
37
38void wrapper1() {
40QDesktopServices::openUrl(QUrl("file:///C:/Program Files", QUrl::TolerantMode));
42}
43
44
45/* comment wrapper 2
46
48<key>LSApplicationQueriesSchemes</key>
49<array>
50 <string>https</string>
51</array>
53
55<key>CFBundleURLTypes</key>
56<array>
57 <dict>
58 <key>CFBundleURLSchemes</key>
59 <array>
60 <string>myapp</string>
61 </array>
62 </dict>
63</array>
65
66*/ // comment wrapper 2
67
68/* comment wrapper 3
70<key>com.apple.developer.associated-domains</key>
71<array>
72 <string>applinks:your.domain.com</string>
73</array>
75
77{
78 "applinks": {
79 "apps": [],
80 "details": [{
81 "appIDs" : [ "ABCDE12345.com.example.app" ],
82 "components": [{
83 "/": "/help",
84 "?": { "topic": "?*"}
85 }]
86 }]
87 }
88}
90
92<intent-filter>
93 <action android:name="android.intent.action.VIEW" />
94 <category android:name="android.intent.category.DEFAULT" />
95 <category android:name="android.intent.category.BROWSABLE" />
96 <data android:scheme="https" android:host="your.domain.com" android:port="1337" android:path="/help"/>
97</intent-filter>
99
101<intent-filter android:autoVerify="true">
103
105[{
106 "relation": ["delegate_permission/common.handle_all_urls"],
107 "target": {
108 "namespace": "android_app",
109 "package_name": "com.example.app",
110 "sha256_cert_fingerprints":
111 ["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"]
112 }
113}]
115
116*/ // comment wrapper 3
117
118} // src_gui_util_qdesktopservices
static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method)
Sets the handler for the given scheme to be the handler method provided by the receiver object.
static bool openUrl(const QUrl &url)
Opens the given url in the appropriate Web browser for the user's desktop environment,...
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qurl.h:94
@ TolerantMode
Definition qurl.h:97
#define Q_OBJECT
#define slots
QUrl url("example.com")
[constructor-url-reference]