[Interest] QFileDialog: what's wrong with this minimal example
Hi all, if I compile this stripped down minimal example - #include #include 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@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
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. From: Wilhelm To: Qt Interest 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 #include 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@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
In Qt 4.8, all I did to get it working was do a fd.show() in between the QFileDialog call and the a.exec(). It also works fine using the static call for QFileDialog::getOpenFileName Scott -Original Message- From: interest-bounces+scott.bloom=onshorecs@qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs@qt-project.org] On Behalf Of Wilhelm Sent: Monday, January 21, 2013 10:33 AM To: Qt Interest Subject: [Interest] QFileDialog: what's wrong with this minimal example Hi all, if I compile this stripped down minimal example - #include #include 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@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
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 > *To:* Qt Interest > *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 > #include > > 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@qt-project.org <mailto:Interest@qt-project.org> > http://lists.qt-project.org/mailman/listinfo/interest > > -- Wilhelm ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
Am 22.01.2013 19:46, schrieb nikita baryshnikov: > Hi > > #include > > #include > > > int main(int argc, char *argv[]) > > { > > QApplication app(argc, argv); > > QFileDialog fd(0, "Load from file", QDir::currentPath(), "All > Files (*)"); > > // fd.exec(); > > // return app.exec(); > > } > > > works good for mewithout any error:( which qt version, which compiler / version did you use? > > > > On Mon, Jan 21, 2013 at 9:41 PM, Wilhelm <mailto:wilhelm.me...@fh-kl.de>> wrote: > > 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 <mailto:wilhelm.me...@fh-kl.de>> > > *To:* Qt Interest <mailto:interest@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 > > #include > > > > 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@qt-project.org <mailto:Interest@qt-project.org> > <mailto:Interest@qt-project.org <mailto:Interest@qt-project.org>> > > http://lists.qt-project.org/mailman/listinfo/interest > > > > > > > -- > Wilhelm > > ___ > Interest mailing list > Interest@qt-project.org <mailto:Interest@qt-project.org> > http://lists.qt-project.org/mailman/listinfo/interest > > -- Wilhelm ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
On 01/21/2013 07:33 PM, Wilhelm wrote: > Hi all, > > if I compile this stripped down minimal example > - > #include > #include > > 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) Could you report this in the bug tracker? -- Samuel ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog: what's wrong with this minimal example
Hi, since I also ran into this on my machine, I created https://bugreports.qt-project.org/browse/QTBUG-29366 with an example and a bit of analysis. The underlying reason is that the creation of a QInotifyFileSystemWatcherEngine fails due to "Too many open files". Regards, Friedemann -- Friedemann Kleint Digia, Qt ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest