Skip to content

Instantly share code, notes, and snippets.

@ferlzc
Created November 25, 2019 14:56
Show Gist options
  • Save ferlzc/7a0ca4ac033a8e928ed17710da77374c to your computer and use it in GitHub Desktop.
Save ferlzc/7a0ca4ac033a8e928ed17710da77374c to your computer and use it in GitHub Desktop.
Testing Qt StorageInfo
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