From: vsr Date: Thu, 21 Apr 2016 15:57:18 +0000 (+0300) Subject: Alternative implementation, with catching custom event X-Git-Tag: V8_1_0b1~25^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=665eb0d1cc1460935a85bbe1e7760492071474c6;p=modules%2Fmed.git Alternative implementation, with catching custom event --- diff --git a/src/MEDCalc/gui/TestController.cxx b/src/MEDCalc/gui/TestController.cxx index c9d71efd1..dfb997922 100644 --- a/src/MEDCalc/gui/TestController.cxx +++ b/src/MEDCalc/gui/TestController.cxx @@ -68,7 +68,8 @@ TestController::TestController(MEDModule* mod): _tester->addEventObserver("xml", new pqXMLEventObserver(_desk)); _tester->addEventSource("xml", new pqXMLEventSource(_desk)); - QTimer::singleShot(0, this, SLOT(onMainEventLoopStarting())); + QApplication::instance()->installEventFilter(this); + //QTimer::singleShot(0, this, SLOT(onMainEventLoopStarting())); } TestController::~TestController() @@ -213,4 +214,12 @@ TestController::processWorkspaceEvent(const MEDCALC::MedEvent* event) void TestController::onMainEventLoopStarting() { _myEventLoopStarted = true; + QApplication::instance()->removeEventFilter(this); +} + +bool TestController::eventFilter(QObject *obj, QEvent *event) +{ + if ( obj == QApplication::instance() && event->type() == 9999 ) + onMainEventLoopStarting(); + return QObject::eventFilter(obj, event); } diff --git a/src/MEDCalc/gui/TestController.hxx b/src/MEDCalc/gui/TestController.hxx index ed8295c1c..d78557e1f 100644 --- a/src/MEDCalc/gui/TestController.hxx +++ b/src/MEDCalc/gui/TestController.hxx @@ -42,6 +42,8 @@ public: bool isMainEventLoopStarted() const { return _myEventLoopStarted; } + bool eventFilter(QObject *obj, QEvent *event); + protected: virtual void customEvent(QEvent * event);