1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : QAD_WaitCursor.h
8 // Author : Vadim SANDLER
12 #ifndef QAD_WAITCURSOR_H
13 #define QAD_WAITCURSOR_H
15 #include <qapplication.h>
18 class QAD_EXPORT QAD_WaitCursor {
21 QAD_WaitCursor() : myStarted( false ), myDepth( 1 ) { start(); }
23 ~QAD_WaitCursor() { if ( !myStarted ) { myDepth--; start(); } else { QApplication::restoreOverrideCursor(); } }
25 // sets WAIT cursor if not set yet
26 void start() { if ( !myStarted ) { while( myDepth-- ) QApplication::setOverrideCursor( Qt::waitCursor ); myStarted = true; } myDepth = 0; }
27 // clears WAIT cursor if set
28 void stop() { if ( myStarted ) { while( QApplication::overrideCursor() ) { QApplication::restoreOverrideCursor(); myDepth++; } myStarted = false; } }
29 // returns true if WAIT cursor is active
30 bool isStarted() { return myStarted; }