Integration with Glib event loop

  • I have a C library that requires a GLib event loop to work, it takes a GMainContext on initialization and allows me to register callback functions. My solution to integrate it with a Qt application is the classic thread + polling approach, I spawn a thread which every 100ms runs a single g_main_context_iteration(). From what I understood, I can't just run the GLib event loop in the thread because it will block there without emitting any Qt signals.

    Is there an approach that does not involve thread + polling?

  • Lifetime Qt Champion


    Yes it is, and IIRC, there's already an implementation of the event dispatcher with Glib.


Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.