X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=chessclockwindow.cpp;h=2a7c7cbdfe6babde463878f7d14749bb855c4efb;hb=e43c493689b3e5a28625a293f811a888bd5042e8;hp=ea0d746397c19cb63ec964a3e325f5a9114553d1;hpb=4918649a6a425f381a3dc4c58a5f17e30a3c843c;p=chessclock diff --git a/chessclockwindow.cpp b/chessclockwindow.cpp index ea0d746..2a7c7cb 100644 --- a/chessclockwindow.cpp +++ b/chessclockwindow.cpp @@ -71,6 +71,10 @@ ChessClockWindow::ChessClockWindow(QWidget *parent) menuBar()->addAction( tr("About"),this, SLOT(about())); menuBar()->addAction(tr("About Qt"), this, SLOT(aboutQt())); + //set the event filter to grap window deactivate + + installEventFilter(this); + } void ChessClockWindow::pause() @@ -148,3 +152,14 @@ ChessClockWindow::~ChessClockWindow() { } + +bool ChessClockWindow::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::WindowDeactivate) { + pause(); + return QObject::eventFilter(obj,event); + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } +}