Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Twisted Qt4 Integration
Tree: 4ee2dc2231

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


As I learned Qt, I finally understood how they want you to do things,
so this is prettty much a complete rewrite from previous versions in
the thread of development.

Everything is pretty much done with signals now.  In addition, if
you're writing a conventional Qt application and just want twisted as
an addon, you can get that by calling reactor.runReturn() instead of
run().  Run blocks, but blocks artifically.  Stoppping and rerunning
the reactor seems to work fine... Qt is the event engine that drives
it all regardless.

There is a way to run trial using a gui... in bin, there is a routine
gtrial.  Put that in the same directory as trial and it pops up a
trivial gui... hit the buton and it all runs the same... don't use the
--reactor option when calling gtrial... but all the other options
appear to work.  This was just to make sure there wasn't anything
strange with guis which there doesn't appear to be

using twisted's trial also works... make sure the qtreactor directory
is in your PYHONPATH and just use the --reactor=qt4 option

Note that if a QApplication or QCoreApplication instance isn't
constructed prior to calling reactor run, an internally owned
QCoreApplication is created and destroyed. This won't work if you call
runReturn instead of run unless you take responsibility for wacking
QCoreApplication yourself...

However, most users want this reactor to do gui stuff so this
shouldn't be an issue.

Included in this directory is a diff of trial's stdout between the
default reactor and the Qt4 reactor.  The large time differences are
due to hangage in some of the I/O tests unrelated to the performance
of the reactor itself which is seems very good.

The diff is for the full test

# trial --rterrors --unclean-warnings --reactor=qt4 twisted 2>&1 | tee /tmp/qt4trial.trial 

# trial --rterrors --unclean-warnings twisted 2>&1 | tee /tmp/selecttrial.trial 

# diff /tmp/select.trial /tmp/qt4.trial > trial.diff

I don't have it here, but for a subset of the tests = twisted.test,
the difference was a few percent.  Something about the full suite
slowing things down.  I'm running profiles now but the tests I ran
indicate a very zippy reactor... these differences are due to it being
incorrect and causing hanging / spinning.


Glenn H. Tarbox, PhD
Something went wrong with that request. Please try again.