[Interest] QFileDialog: what's wrong with this minimal example

Wilhelm wilhelm.meier at fh-kl.de
Mon Jan 21 20:41:52 CET 2013


Am 21.01.2013 19:36, schrieb Jason H:
> Looks ok. But try calling a.exec() and using a singleshot zero timeout
> timer (beforr a.exec()) to bring up the file dialog. Let us know if that
> works.

That all works. I stripped down the example to bring only the run-time 
error. Looks like a Qt5-error, because the error doesn't show up in Qt 
4.8.3. e.g.

I tries various g++ versions witg Qt5, but the run-time error remains.

Any Qt5 hints?

>
>
>
> ------------------------------------------------------------------------
> *From:* Wilhelm <wilhelm.meier at fh-kl.de>
> *To:* Qt Interest <interest at qt-project.org>
> *Sent:* Monday, January 21, 2013 1:33 PM
> *Subject:* [Interest] QFileDialog: what's wrong with this minimal example
>
> Hi all,
>
> if I compile this stripped down minimal example
> -------------
> #include <QApplication>
> #include <QFileDialog>
>
> int main(int argc, char *argv[])
> {
>      QApplication a(argc, argv);
>      QFileDialog fd(0, "Load from file",
>                      QDir::currentPath(),
>                      "All Files (*)");
>
>      //    return a.exec();
> }
> ---------------
>
> I get the following run-time error:
>
> QObject: Cannot create children for a parent that is in a different thread.
> (Parent is QFileSystemWatcher(0x1770be0), parent's thread is
> QThread(0x1734420), current thread is QFileInfoGatherer(0x1791c58)
>
>
> It is compiled with QT5.0.0 and g++ (GCC) 4.8.0 20130113 (experimental):
>
> make[2]: Entering directory
> `/home/lmeier/Software/qtwm/trunk/apps/apps5-build-QT5-Debug/test/test4'
> g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_WIDGETS_LIB
> -DQT_GUI_LIB -DQT_CORE_LIB
> -I/opt/Qt5.0.0/5.0.0/gcc_64/mkspecs/linux-g++-64
> -I../../../apps5/test/test4 -I/opt/Qt5.0.0/5.0.0/gcc_64/include
> -I/opt/Qt5.0.0/5.0.0/gcc_64/include/QtWidgets
> -I/opt/Qt5.0.0/5.0.0/gcc_64/include/QtGui
> -I/opt/Qt5.0.0/5.0.0/gcc_64/include/QtCore -I. -I. -o main.o
> ../../../apps5/test/test4/main.cc
> make[1]: Entering directory
> `/home/lmeier/Software/qtwm/trunk/apps/apps5-build-QT5-Debug/lib'
> make[1]: Nothing to be done for `first'.
> make[1]: Leaving directory
> `/home/lmeier/Software/qtwm/trunk/apps/apps5-build-QT5-Debug/lib'
> g++ -m64 -Wl,-rpath,/opt/Qt5.0.0/5.0.0/gcc_64
> -Wl,-rpath,/opt/Qt5.0.0/5.0.0/gcc_64/lib -o test4 main.o
> -L/usr/X11R6/lib64 -L/opt/Qt5.0.0/5.0.0/gcc_64/lib -lQt5Widgets -lQt5Gui
> -lQt5Core -lGL -lpthread
>
> --
> Wilhelm
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org <mailto:Interest at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
Wilhelm




More information about the Interest mailing list