2

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.

beta
  • 647
  • 5
  • 19
  • Did you try to implement the archive handling as a QAbstractFileEngine? That should give you most if not all of the above for free. – Frank Osterfeld Mar 22 '12 at 19:08
  • @FrankOsterfeld: Abstract file engines module is deprecated, according to http://blog.qt.digia.com/2011/05/12/qt-modules-maturity-level-the-list/ – Vojislav Stojkovic Oct 30 '12 at 13:30

1 Answers1

0

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
Masci
  • 5,864
  • 1
  • 26
  • 21