Hooking the QT Main Loop

Doug Goldstein cardoe at gentoo.org
Mon Apr 16 11:19:38 PDT 2007


Kevin DeKorte wrote:
> Hello,
>
> 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.
>
> Kevin
AFAIK, the QT3 bindings are unmaintained. QT3 itself is no longer
maintained by Trolltech as of July 1st of this year. Trolltech maintains
the QT4 bindings in QT itself, as of QT 4.2 and within that it contains
direct integration with the glib main loop. You might have much better
success working with QT4.


More information about the dbus mailing list