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_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
7 QStorageInfo storage(qApp->applicationDirPath());
9 // ...
10 }
12
15 if (storage.isValid() && storage.isReady()) {
16 if (!storage.isReadOnly()) {
17 // ...
18 }
19 }
20 }
22
25
27 if (storage.isReadOnly())
28 qDebug() << "isReadOnly:" << storage.isReadOnly();
29
30 qDebug() << "name:" << storage.name();
31 qDebug() << "fileSystemType:" << storage.fileSystemType();
32 qDebug() << "size:" << storage.bytesTotal()/1000/1000 << "MB";
33 qDebug() << "availableSize:" << storage.bytesAvailable()/1000/1000 << "MB";
\inmodule QtCore
static QList< QStorageInfo > mountedVolumes()
Returns the list of QStorageInfo objects that corresponds to the list of currently mounted filesystem...
QString name() const
Returns the human-readable name of a filesystem, usually called label.
qint64 bytesTotal() const
Returns the total volume size in bytes.
bool isValid() const
Returns true if the QStorageInfo specified by rootPath exists and is mounted correctly.
qint64 bytesAvailable() const
Returns the size (in bytes) available for the current user.
static QStorageInfo root()
Returns a QStorageInfo object that represents the system root volume.
bool isReady() const
Returns true if the current filesystem is ready to work; false otherwise.
QString rootPath() const
Returns the mount point of the filesystem this QStorageInfo object represents.
QByteArray fileSystemType() const
Returns the type name of the filesystem.
bool isReadOnly() const
Returns true if the current filesystem is protected from writing; false otherwise.
#define qApp
qDebug()<< storage.rootPath()
[1]
QStorageInfo storage
[1]