return synced;
}
+void DrawingWindow::closeGraph()
+{
+ qApp->postEvent(this, new QEvent(QEvent::Type(QEvent::User + 1)));
+}
+
void DrawingWindow::sleep(unsigned long secs)
{
DrawingThread::sleep(secs);
thread->wait();
}
-void DrawingWindow::customEvent(QEvent *)
+void DrawingWindow::customEvent(QEvent *ev)
{
- mayUpdate();
- qApp->sendPostedEvents(this, QEvent::UpdateLater);
- qApp->sendPostedEvents(this, QEvent::UpdateRequest);
- qApp->sendPostedEvents(this, QEvent::Paint);
- qApp->processEvents(QEventLoop::ExcludeUserInputEvents |
- QEventLoop::ExcludeSocketNotifiers |
- QEventLoop::DeferredDeletion |
- QEventLoop::X11ExcludeTimers);
- qApp->flush();
- qApp->syncX();
- syncMutex.lock();
- syncCondition.wakeAll();
- syncMutex.unlock();
+ switch ((int )ev->type()) {
+ case QEvent::User:
+ mayUpdate();
+ qApp->sendPostedEvents(this, QEvent::UpdateLater);
+ qApp->sendPostedEvents(this, QEvent::UpdateRequest);
+ qApp->sendPostedEvents(this, QEvent::Paint);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents |
+ QEventLoop::ExcludeSocketNotifiers |
+ QEventLoop::DeferredDeletion |
+ QEventLoop::X11ExcludeTimers);
+ qApp->flush();
+ qApp->syncX();
+ syncMutex.lock();
+ syncCondition.wakeAll();
+ syncMutex.unlock();
+ break;
+ case QEvent::User + 1:
+ close();
+ break;
+ }
}
void DrawingWindow::keyPressEvent(QKeyEvent *ev)