33class QStorageInfoPrivate :
public QSharedData
36 QStorageInfoPrivate() =
default;
40 static QList<QStorageInfo> mountedVolumes();
42 static QStorageInfo root()
45 return QStorageInfo(QDir::fromNativeSeparators(QFile::decodeName(qgetenv(
"SystemDrive"))));
47 return QStorageInfo(QStringLiteral(
"/"));
54 void retrieveVolumeInfo();
55 void retrieveDiskFreeSpace();
56 bool queryStorageProperty();
57 void queryFileFsSectorSizeInformation();
58#elif defined(Q_OS_DARWIN)
60 void retrievePosixInfo();
61 void retrieveUrlProperties(
bool initRootPath =
false);
63#elif defined(Q_OS_LINUX)
64 void retrieveVolumeInfo();
76 void setFromMountInfo(MountInfo &&info)
78 rootPath = std::move(info.mountPoint);
79 fileSystemType = std::move(info.fsType);
80 device = std::move(info.device);
81 subvolume = std::move(info.fsRoot);
84 QStorageInfoPrivate(MountInfo &&info)
86 setFromMountInfo(std::move(info));
89#elif defined(Q_OS_UNIX)
91 void retrieveVolumeInfo();
96 template <
typename String>
97 static bool isParentOf(
const String &parent,
const QString &dirName)
99 return dirName.startsWith(parent) &&
100 (dirName.size() == parent.size() || dirName.at(parent.size()) == u'/' ||
103 static inline bool shouldIncludeFs(
const QString &mountDir,
const QByteArray &fsType);
109 QByteArray subvolume;
110 QByteArray fileSystemType;
113 qint64 bytesTotal = -1;
114 qint64 bytesFree = -1;
115 qint64 bytesAvailable = -1;
118 bool readOnly =
false;
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames, { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, { Qt::EditRole, "edit" }, { Qt::ToolTipRole, "toolTip" }, { Qt::StatusTipRole, "statusTip" }, { Qt::WhatsThisRole, "whatsThis" }, }) const QHash< int