C++ (Qt)#include <QApplication>#include <QMainWindow> class MaintWindow : public QMainWindow{ Q_OBJECTpublic: MainWindow( QWidget * parent = 0, Qt::WindowFlags flags = 0 ) : QMainWindow( parent, flags ) , busy_( false ) { qApp->installEventFilter( this ); } virtual ~MainWindow() {} void setBusy( bool set ) { busy_ = set; } bool busy() const { return busy_; } protected: bool eventFilter( QObject* o, QEvent* e ) { if( o == this ) return false; QWidget* w = o->isWidgetType() ? qobject_cast< QWidget* >( o ) : 0; if( w && w->window() == this ) { if( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease || e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonRelease || e->type() == QEvent::MouseButtonDblClick || e->type() == QEvent::MouseMove || e->type() == QEvent::ContextMenu || e->type() == QEvent::Wheel ) { if( busy_ ) return true; } } return false; }private: bool busy_;};