質問

I am currently implementing a project system that uses an archive instead of a directory to hold subfiles. I keep a data structure that holds the project's virtual file system, and write it out as need be.

I am now trying to implement the graphical front end for this virtual file system, and I was wanting to use a QFileDialog to "save" to the virtual file system.

I've done a bit of research, and it appears that I'll need to subclass QFileSystemModel or implement a proxy model. The latter appears to be more meant for modifying existing models for sorting and filtering, while I want to completely replace it, so I didn't think it was a good option. I dug through QFileSystemModel's source code, and it also appears to be difficult to repurpose. I'm a Qt Model/View novice, so I might be mistaken.

What is the correct way to repurpose the QFileDialog for a virtual file system? I would think this would be at least somewhat documented, as I can think of several scenarios where this might be useful.

If someone could point me in the right direction I'd be very thankful.

役に立ちましたか?

解決

This is what I'd do:

  • Implement the data structure for the virtual filesystem as a custom QAbstractItemModel
  • Build my own file save dialog as a QDialog showing a QTreeView attached to the forementioned model
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top