Hooking the QT Main Loop

Kevin DeKorte kdekorte at gmail.com
Mon Apr 16 09:47:18 PDT 2007

Hash: SHA1


I'm developing a program in C/C++ that can be embedded in a QT app, but
I don't need to have the plugin use anything from QT, but I need my
plugin which talks to another app over dbus to have dbus hook into the
main loop.

With a glib version of the app I can do this

app (running GLIB main loop) -> load plugin which hooks into glib main
loop using dbus_connection_setup_with_g_main -> which the plugin can
then send and receive signals from an out of process application.

I tried the same thing with a QT app, but I can't seem to figure out how
to make dbus_connection_setup_with_qt_main work. When I link the plugin
to QT3 I get a ton of missing includes, but only when I include the
dbus-qt-1 include file <dbus/connection.h>. I can get a good compile by
including <dbus/dbus-qt.h>, but then the symbol
dbus_connection_setup_with_qt_main is not found. Since my plugin is
mainly C based, I would prefer if I didn't have to bring in all the C++
code from QT3. The problem I have with my plugin right now is that I can
send a signal, but the plugin doesn't receive one until the plugin is
shutting down. So I'm guessing that the dbus thread is not hooked up
right to the event loop.

Is there an example some where that shows something like what I am
wanting to do.

- --
Get my public GnuPG key from
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org


More information about the dbus mailing list