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

Scott Aron Bloom scott.bloom at onshorecs.com
Mon Jan 21 19:50:11 CET 2013


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.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at 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 <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
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list