[Interest] QFileSystemModel broken in Qt5? (minimal example)

Wilhelm wilhelm.meier at fh-kl.de
Tue Jan 22 08:17:45 CET 2013


Hi all,

I have this minimal example:

-----
#include <QApplication>
#include <QFileSystemModel>

int main(int argc, char *argv[])
{
     QApplication a(argc, argv);

     QFileSystemModel* fileSystemModel = new QFileSystemModel(0);
     fileSystemModel->setRootPath(QDir::homePath());
     fileSystemModel->setFilter(QDir::AllDirs | QDir::Files);

     return a.exec();
}
-----

If I compile against Qt5 and run this small program, I get the following 
run-time error:

Starte /home/lmeier/fd1-build-QT5-Debug/fd1...
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QFileSystemWatcher(0xa82d80), parent's thread is 
QThread(0xa47420), current thread is QFileInfoGatherer(0xa84048)

-----

The error doesn't show up with Qt 4.8.3 at least.

So, what's wrong here?

-- 
Wilhelm




More information about the Interest mailing list