2 * \file InGuiThread.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InGuiThread.h"
17 #include <QApplication>
23 IntoGuiThreadMover::IntoGuiThreadMover()
28 void IntoGuiThreadMover::callInGuiThread()
30 QThread* gui_thread = QApplication::instance()->thread();
31 if (QThread::currentThread() == gui_thread) {
32 synchronousFunctionCall();
34 moveToThread(gui_thread);
35 connect(this, SIGNAL(triggerCall()), this, SLOT(doFunctionCall()),
36 Qt::QueuedConnection);
37 // TODO try with condition, it's maybe cheaper
39 connect(this, SIGNAL(called()), &loop, SLOT(quit()));
46 void IntoGuiThreadMover::doFunctionCall()
48 synchronousFunctionCall();
53 } // namespace frontend
56 #include "moc_InGuiThread.cpp"