[Interest] QFileSystemModel broken in Qt5? (minimal example)
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Tue Jan 22 08:50:58 CET 2013
On Tue, Jan 22, 2013 at 12:47 PM, Wilhelm <wilhelm.meier at fh-kl.de> wrote:
> 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)
Your code seems to be fine.
QFSM, IIRC, uses a separate thread for scanning the FS and updating
the model (in Qt4.7+ at least). So this message seems to be related to
that thread. Something broke there in Qt5?
-mandeep
>
> -----
>
> The error doesn't show up with Qt 4.8.3 at least.
>
> So, what's wrong here?
>
> --
> Wilhelm
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list