[Interest] "-glib" has no effect?

Thiago Macieira thiago.macieira at intel.com
Sat Feb 21 04:56:32 CET 2015


On Saturday 21 February 2015 04:34:07 Nikos Chantziaras wrote:
> On 21/02/15 00:08, Thiago Macieira wrote:
> > On Friday 20 February 2015 22:51:40 Nikos Chantziaras wrote:
> >> The only question remaining now is whether invokeMethod() needs the
> >> GMainLoop thread to be started by a QThread for Qt::QueuedConnection
> >> invocations to be guaranteed to work, or if a GThread will do. It seems
> >> to work with a GThread just fine, but this might be just circumstantial?
> > 
> > The origin of the call is irrelevant. The important part is that the
> > target
> > thread (the thread the object is associated with) be running a
> > QEventDIspatcherWin32.
> 
> Thanks. Since the target thread is the GUI thread, that should be
> guaranteed.
> 
> Last question (I promise :-P): is there a way to detect at runtime
> whether Qt has glib support? Right now I'm simply assuming that all
> Linux users have a Qt built with "-glib" (so in that case a glib event
> loop is not used.) But can the case where it was built with "-no-glib"
> be detected?

I'd do this:

	auto mainThread = QCoreApplication::thread();
	auto mo = QAbstractEventDispatcher::instance(mainThread)->metaObject();
	if (strcmp(mo->className(), "QEventDispatcherGlib") == 0 ||
		strcmp(mo->superClass()->className(), "QEventDispatcherGlib") == 0)
		....

The two glib event dispatcher classes are called QEventDispatcherGlib and 
QPAEventDispatcherGlib. The latter derives from the former.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list