Created
November 25, 2019 14:56
-
-
Save ferlzc/7a0ca4ac033a8e928ed17710da77374c to your computer and use it in GitHub Desktop.
Testing Qt StorageInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StorageCheck : public QStorageInfo | |
{ | |
Q_OBJECT | |
Q_PROPERTY(QString errorString READ getErrorString NOTIFY errorChanged) | |
Q_PROPERTY(bool error READ getError NOTIFY errorChanged) | |
public: | |
StorageCheck(QString path); | |
~StorageCheck(); | |
} | |
QString path = "/tmp" | |
QStorageInfo storage(path); | |
if (storage.isValid() && storage.isReady()) { | |
qDebug() << "name:" << storage.name(); | |
qDebug() << "fileSystemType:" << storage.fileSystemType(); | |
qDebug() << "size:" << storage.bytesTotal()/1000/1000 << "MB"; | |
qDebug() << "availableSize:" << storage.bytesAvailable()/1000/1000 << "MB"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment