diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index 184baa8f7..558e3cf43 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -776,7 +776,10 @@ ApplicationBase::init_app () // establish the configuration dispatcher ()->config_setup (); - // Some info output + // deferred method processing for those plugins which need this + process_events (); + + // some info output if (tl::verbosity () >= 20) { tl::info << "KLayout path:"; @@ -1504,6 +1507,9 @@ GuiApplication::process_events_impl (QEventLoop::ProcessEventsFlags flags, bool mp_mw->enter_busy_mode (true); try { QApplication::processEvents (flags); + // Qt seems not to send posted UserEvents in some cases (e.g. in the unit test application with GLib? + // Glib not doing this without a main window visible?). Hence we do this explicitly here. + QApplication::sendPostedEvents (); } catch (...) { // ignore exceptions } diff --git a/src/tl/tl/tlDeferredExecutionQt.cc b/src/tl/tl/tlDeferredExecutionQt.cc index 1f67632a9..6e1c125a5 100644 --- a/src/tl/tl/tlDeferredExecutionQt.cc +++ b/src/tl/tl/tlDeferredExecutionQt.cc @@ -32,6 +32,8 @@ namespace tl DeferredMethodSchedulerQt::DeferredMethodSchedulerQt () : QObject (qApp), DeferredMethodScheduler () { + m_event_type = QEvent::registerEventType (); + connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timer ())); m_timer.setInterval (0); // immediately @@ -51,13 +53,13 @@ DeferredMethodSchedulerQt::~DeferredMethodSchedulerQt () void DeferredMethodSchedulerQt::queue_event () { - qApp->postEvent (this, new QEvent (QEvent::User)); + qApp->postEvent (this, new QEvent (QEvent::Type (m_event_type))); } bool DeferredMethodSchedulerQt::event (QEvent *event) { - if (event->type () == QEvent::User) { + if (event->type () == m_event_type) { timer (); return true; } else { diff --git a/src/tl/tl/tlDeferredExecutionQt.h b/src/tl/tl/tlDeferredExecutionQt.h index f9afba7f6..06f0e2e48 100644 --- a/src/tl/tl/tlDeferredExecutionQt.h +++ b/src/tl/tl/tlDeferredExecutionQt.h @@ -65,6 +65,7 @@ private slots: private: QTimer m_timer, m_fallback_timer; + int m_event_type; virtual bool event (QEvent *event); }; diff --git a/testdata/ruby/imgObject.rb b/testdata/ruby/imgObject.rb index 7c1af0ae8..2a8f9a853 100644 --- a/testdata/ruby/imgObject.rb +++ b/testdata/ruby/imgObject.rb @@ -396,7 +396,7 @@ class IMG_TestClass < TestBase end - def test_4 + def test_5 tmp = File::join($ut_testtmp, "tmp.lyimg")