PDA

View Full Version : QDirModel, QCompleter, and Windows UNC paths



SnarlCat
16th April 2009, 03:20
All-

I'm having trouble getting a QDirModel to work nicely with a QCompleter and Windows UNC paths (\\Server\Share\((folder\)*)file -formatted paths).

The examples (http://doc.trolltech.com/4.4/itemviews-dirview.html) work perfectly for all "local" paths with drive letters (even mounted network paths), but UNC seems to stump the QDirModel.

The model seems to be initialized with all the drives (A:, C:, D:, Q:, etc) -- is there a way to initialize it with a server or server/share?

Assuming that can be done, should the QCompleter just be aware of the directory/file structure? I would think so as the completer is interpreting the data from the underlying model, but I just want to be sure...

Thanks in advance!

SnarlCat

wysota
17th April 2009, 09:27
As far as I remember from my own experiments QDirModel can be initialized from any valid path accepted by Qt (contrary to QFileSystemModel which only accepts real paths) so if you implement a file handler similar to the one used for resource files, you should be able to get the desired output. But it will work very slow, QDirModel is far from being optimal so it might be easier to implement a completely custom model that would first fetch the desired content using native samba calls and then initialize itself with the data.