Category Archives: Qt

PyQt4 QFileDialog freezes when qt4reactor is running

To use the twisted reactor inside a Qt gui application, I’m using the qt4reactor package:

app = QtGui.QApplication(sys.argv)

import qt4reactor

from twisted.internet import reactor
factory = Factory()

gui = Gui(app)


But I realized that after the “reactor.runReturn()” line, each QFileDialog freezes the complete program.

filename = QtGui.QFileDialog.getOpenFileName()

A solution is to use the non-native dialog instead:

filename = QtGui.QFileDialog.getOpenFileName(options=QtGui.QFileDialog.DontUseNativeDialog)
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Cross compile Qt-Apps for windows

I hate it to reboot my computer only to compile my qt apps for some windows users. And my vm doesn’t work anymore. So I was looking for a better way to solve my problem..

Well, i think you will have installed qt on your machine 😉 if not:

doep@doep ~ $ emerge -av x11-libs/qt-core

To build a win32 cross compiler crossdev would be helpful:

doep@doep ~ $ emerge -av sys-devel/crossdev

Now we can start with our gcc.  You have to do the following steps as root. To lists all supported architectures use:

doep ~ # crossdev -t help

The one we need is mingw32. Now we have to wait a bit until gcc, libc and binutils are ready.

doep ~ # crossdev -t mingw32

If no error occurs, gcc-config should create an output like this.

doep ~ # gcc-config -l
[1] mingw32-4.4.2 *
[2] i686-pc-linux-gnu-4.2.4
[3] i686-pc-linux-gnu-4.3.2 *
[4] i686-pc-linux-gnu-4.4.0
[5] x86_64-pc-linux-gnu-4.3.3
[6] x86_64-pc-linux-gnu-4.4.1 *

Download a windows qt version and install it. Then link the created folder to /usr/share/qt4win . You can also use wine to install the Qt package.

doep ~ # ln -s /mnt/win/Qt/4.5.0 /usr/share/qt4win

Now we have to create a qt spec folder in /usr/share/qt4/mkspecs/ called win32-x-g++. You can download the spec file here: win32-x-g++.tar

doep ~ # tar xvzf win32-x-g++.tar.gz -C /usr/share/qt4/mkspecs/

You are now ready to “try” to cross compile your program !! But first do a cleanup:

doep@doep ~ $ make distclean

Then tell qmake to use our win32-x-g++ spec:

doep@doep ~ $ qmake -spec win32-x-g++

And then start the compilation:

doep@doep ~ $ make -j4

Your application now needs the additionally libgcc_s_sjlj-1.dll to start. It’s located in:

VN:F [1.9.22_1171]
Rating: 4.0/10 (2 votes cast)
Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.