[Qt-interest] QAbstractFileEngine & QFileSystemWatcher

Solal Jacob solal.jacob at ArxSys.fr
Wed Feb 10 16:08:10 CET 2010


Hi,

I would like to use QAbstractFileEngine/Handler to  be able to  use 
QFileSystemModel to display a user-land VFS.
My problem is that by default QFileSystemModel use a QFileSystemWatcher
through a QFileInfoGatherer to be able to update the model content,
but QFileSystemWatcher try to register the virtual file of my FileEngine
with hardcoded system functions (ex: inotify under linux)
as it can't register the file because they didn't exists on the system
it give me this error :

QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No
such file or directory
QFileSystemWatcher: failed to add paths: XXX


I would know if there is a way to register my own file notifications
method inside the QFileSystemWatcher class,
as I look at the code I just find that I can recompile QT with the
options QT_NO_FILESYSTEMWATCHER, but I would like
to be able to use the default QT lib.
I also found that it's possible to use a 'poll' engine or a forced
engine by specifying "_qt_autotest_force_engine_X" to the object name,
but I didn't know how to find the right object as QFileSystemModel use a
thread  ( QFileInfoGatherer  ) to create the QFileSystemWatcher,
and if this method will not be changed in futur versions of QT.

The last solutions is to rewrite some part of the Model, but it would
more powerfull if we could use an abstract QFileSystemWatcher for a
registred QAbstractFileEngine.
I certainly misunderstood some concepts but I doesn't understand the
interest of QAbstractFileEngine if we can't use it with QFileSystemModel
because of the hard-coded
QFileSystemWatcher notify method.

If anyone as an other solution than rewriting the model or can help me
to understand how to use "_qt_autotest_force_engine" please let me know.

Thanks.

Solal Jacob.

-- 
Solal Jacob 		   solal.jacob at arxsys.fr





More information about the Qt-interest-old mailing list