Salome HOME
fa8efc2fc4b32b06d009aeca2d9aa5b25a9db602
[modules/gui.git] / src / SUIT / SUIT_OverrideCursor.cxx
1 #include "SUIT_OverrideCursor.h"
2
3 SUIT_OverrideCursor::SUIT_OverrideCursor()
4 {
5   QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
6 }
7
8 SUIT_OverrideCursor::SUIT_OverrideCursor( const QCursor& cursor )
9 {
10   QApplication::setOverrideCursor( cursor );
11 }
12
13 SUIT_OverrideCursor::~SUIT_OverrideCursor()
14 {
15   QApplication::restoreOverrideCursor();
16 }
17
18 bool SUIT_OverrideCursor::isActive() const
19 {
20   return myCursors.isEmpty();
21 }
22
23 void SUIT_OverrideCursor::suspend()
24 {
25   if ( !isActive() )
26     return;
27
28   while ( QApplication::overrideCursor() )
29   {
30     myCursors.prepend( *QApplication::overrideCursor() );
31     QApplication::restoreOverrideCursor();
32   }
33 }
34
35 void SUIT_OverrideCursor::resume()
36 {
37   if ( isActive() )
38     return;
39
40   for ( QValueList<QCursor>::const_iterator it = myCursors.begin(); it != myCursors.end(); ++it )
41     QApplication::setOverrideCursor( *it );
42
43   myCursors.clear();
44 }