[SOLVED] Free disk space
-
Is there any Qt class which provides info about free disk space?
-
-Not that I know of.-
-
No API for that, sorry. Use platform-dependent code, or see if boost::filesystem::space is fine with you.
-
Yes, try QtMobility QtSystemStorageInfo class.
-
Thanks for the correction, Lorn.
-
[quote author="lpotter" date="1299610547"]Yes, try QtMobility QtSystemStorageInfo class.[/quote]
Thanks, I completely missed that class. But how are you supposed to use it? All it does (in 1.1) is reporting a list of drives...
-
[quote author="peppe" date="1299839932"]
[quote author="lpotter" date="1299610547"]Yes, try QtMobility QtSystemStorageInfo class.[/quote]Thanks, I completely missed that class. But how are you supposed to use it? All it does (in 1.1) is reporting a list of drives...[/quote]
Based on the documentation "here":http://doc.qt.nokia.com/qtmobility-1.2/qsystemstorageinfo.html , I gather that:
You can only be notified of changes in the storage state
You can't get the actual free storage, only undefined classifications of that storage (Unknown, Normal, Low, Very Low, Critical)
Though there is an enum for it, I don't see a documented way to actually get the drive type
All in all, I get the feeling the documentation may be incomplete.
Edit: indeed, the documentation is incomplete. If you read the "example code":http://doc.qt.nokia.com/qtmobility-1.2/sysinfo-dialog-cpp.html, you find some additional member functions:
- QSystemStorageInfo::DriveType QSystemStorageInfo::typeForDrive(volName)
- ??? QSystemStorageInfo::totalDiskSpace(volName)
- ??? QSystemStorageInfo::availableDiskSpace(volName)
That clears up a lot of confusion. It will take a look at the header for QSystemStorageInfo to see what other functions are available...
-
Oh, nice one. I just quick glanced through 1.1 and 1.2 docs and saw nothing like that :-)
-
I saw it somewhere on the net in 1.2 docs.
-
here's the link:
http://doc.qt.nokia.com/qt-mobility-snapshot/qsystemstorageinfo.html