1 #include <cpBaseQtApplication/Blocker.h>
2 #include <QApplication>
4 // -------------------------------------------------------------------------
5 cpBaseQtApplication::Blocker::
11 // -------------------------------------------------------------------------
12 cpBaseQtApplication::Blocker::
17 // -------------------------------------------------------------------------
18 void cpBaseQtApplication::Blocker::
22 dynamic_cast< QApplication* >( QApplication::instance( ) );
25 app->setOverrideCursor( Qt::WaitCursor );
26 app->installEventFilter( this );
31 // -------------------------------------------------------------------------
32 void cpBaseQtApplication::Blocker::
36 dynamic_cast< QApplication* >( QApplication::instance( ) );
39 while( app->overrideCursor( ) )
40 app->restoreOverrideCursor( );
41 app->removeEventFilter( this );
46 // -------------------------------------------------------------------------
47 bool cpBaseQtApplication::Blocker::
48 eventFilter( QObject* obj, QEvent* event )
50 return( true ); // -> Block all events
51 /* NOTE: this should be the correct implementation:
52 switch( event->type( ) )
54 //list event you want to prevent here ...
55 case QEvent::KeyPress:
56 case QEvent::KeyRelease:
57 case QEvent::MouseButtonRelease:
58 case QEvent::MouseButtonPress:
59 case QEvent::MouseButtonDblClick:
63 return( this->QObject::eventFilter( obj, event ) );