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_qstorageinfo.cpp
Go to the documentation of this file.
1
// Copyright (C) 2014 Ivan Komissarov
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
undef
QT_NO_FOREACH
// this file contains unported legacy Q_FOREACH uses
5
6
#
include
<
QStorageInfo
>
7
#
include
<
QCoreApplication
>
8
9
void
example
()
10
{
11
{
12
//! [0]
13
QStorageInfo storage(qApp->applicationDirPath());
14
if
(storage.isValid() && storage.isReady()) {
15
// ...
16
}
17
//! [0]
18
}
19
20
{
21
//! [1]
22
foreach (
const
QStorageInfo &storage, QStorageInfo::mountedVolumes()) {
23
if
(storage.isValid() && storage.isReady()) {
24
if
(!storage.isReadOnly()) {
25
// ...
26
}
27
}
28
}
29
//! [1]
30
}
31
32
{
33
//! [2]
34
QStorageInfo storage = QStorageInfo::root();
35
36
qDebug() << storage.rootPath();
37
if
(storage.isReadOnly())
38
qDebug() <<
"isReadOnly:"
<< storage.isReadOnly();
39
40
qDebug() <<
"name:"
<< storage.name();
41
qDebug() <<
"fileSystemType:"
<< storage.fileSystemType();
42
qDebug() <<
"size:"
<< storage.bytesTotal()/1000/1000 <<
"MB"
;
43
qDebug() <<
"availableSize:"
<< storage.bytesAvailable()/1000/1000 <<
"MB"
;
44
//! [2]
45
}
46
}
example
void example()
[5]
Definition
doc_src_groups.cpp:7
qtbase
src
corelib
doc
snippets
code
src_corelib_io_qstorageinfo.cpp
Generated on
for Qt by
1.18.0