Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
src_corelib_io_qfileselector.cpp
Go to the documentation of this file.
1
// Copyright (C) 2018 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QFileSelector
>
5
#
include
<
QFile
>
6
#
include
<
QLocale
>
7
8
void
example
()
9
{
10
{
11
//! [0]
12
QString defaultsBasePath =
"data/"
;
13
QString defaultsPath = defaultsBasePath +
"defaults.conf"
;
14
QString localizedPath = defaultsBasePath
15
+ QString(
"%1/defaults.conf"
).arg(QLocale().name());
16
if
(QFile::exists(localizedPath))
17
defaultsPath = localizedPath;
18
QFile defaults(defaultsPath);
19
//! [0]
20
}
21
22
{
23
//! [1]
24
QString defaultsPath =
"data/defaults.conf"
;
25
#
if
defined
(
Q_OS_ANDROID
)
26
defaultsPath =
"data/android/defaults.conf"
;
27
#
elif
defined
(
Q_OS_IOS
)
28
defaultsPath =
"data/ios/defaults.conf"
;
29
#
endif
30
QFile defaults(defaultsPath);
31
//! [1]
32
33
//! [2]
34
QFileSelector selector;
35
QFile defaultsFile(selector.select(
"data/defaults.conf"
));
36
//! [2]
37
}
38
}
39
40
#
if
0
41
//! [3]
42
data/defaults.conf
43
data/+android/defaults.conf
44
data/+ios/+en_GB/defaults.conf
45
//! [3]
46
47
//! [4]
48
images/background.png
49
images/+android/+en_GB/background.png
50
//! [4]
51
52
//! [5]
53
images/background.png
54
images/+linux/background.png
55
images/+windows/background.png
56
images/+admin/background.png
57
images/+admin/+linux/background.png
58
//! [5]
59
#
endif
example
void example()
[5]
Definition
doc_src_groups.cpp:7
qtbase
src
corelib
doc
snippets
code
src_corelib_io_qfileselector.cpp
Generated on
for Qt by
1.18.0