Can I make own file system access with QFileSystemModel?
-
Dear all,
QFileSystemModel is used to access data model for local file system.
Is that possible to access own file system? (e.g., custom file system which contains in single file like virtual CD, ISO files)
Is there will be need to modified QFileSystemModel?
Thanks
-
Why not subclass QAbstractItemModel and provide the data as you see fit?
-
Yes, but it needs to make a new class similar like QFileSystemModel.
I would like to know is there any way to make file system file to access with QFileSystemModel.
I would like to access such file structure on my custom file system with QFileSystemModel because new implementation will make a huge cost...
Thanks
-
If you need to present your custom file system the same way QFileSystemModel does then you really do need to subclass QAbstractItemModel (the same as QFileSystemModel) and implement the details. Even if you subclassed QFileSystemModel you would have to override all of its methods anyway to provide your own data at which point you might as well just subclass QAbstractItemModel.
-
Sounds like you are looking for [[doc:QAbstractFileEngine]]. I am not sure it is used for QFileSystemModel though, and AFAIK it will not return in Qt5, as it is now considdered a design mistake. However, if Qt5 compatibility is not an issue for you, then perhaps it is a solution for your case.
-
yes, thanks.
it looks right option for me.Can I know any substitute solution for that class in Qt5 when it is removed?
-
There is an overview somewhere on the status of modules. I am not actually sure that it will be removed, it might just be depricated. Dig for some more information on this before you commit to using the technology. Also: I am not sure QFileSystemModel actually uses this abstraction. The documentation of QAbstractFileEngline only mentions QDir, QFile and QFileInfo.
AFAIK, there is not going to be a replacement. The feeling is, if I understand & remember it correctly, that Qt is the wrong level to solve the issue, and it should be solved at the OS level instead.
-
"Qt Modules’ Maturity Level":http://labs.qt.nokia.com/2011/05/12/qt-modules-maturity-level-the-list/
[quote]
Abstract file engines
State: Deprecated
Reasoning: flawed design, this is the wrong level to provide a virtual filesystem, so we don’t recommend taking this over. In Qt 5, this functionality will be Removed.
[/quote] -
Thanks for your info.
So, how will be suitable method to provide such custom virtual file system?
Thanks
-
It looks like this was never answered. It's strange to me that QAbstractFileEngine was taken out considering Android "assets:" was added, "qrc:" has always been around, and it would be a really seamless way to integrate many things that just can't be integrated at the OS level when you don't have full control over the machine. How is it a "design flaw" to have this interface? Is GDAL VSI flawed? I think that's a matter of opinion, but the fact remains that many libraries have to work with both file and memory APIs. If a library is based on Qt, it would be nice to be able to make an abstract file system and be done with integration.