Salome HOME
Method setShown( bool ) was added. This method allow to show or hide all views.
[modules/gui.git] / src / SUIT / SUIT_OverrideCursor.cxx
1 #include "SUIT_OverrideCursor.h"
2
3 /*!Constructor. Initialize wait cursor.*/
4 SUIT_OverrideCursor::SUIT_OverrideCursor()
5 {
6   QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
7 }
8
9 /*!Copy constructor.*/
10 SUIT_OverrideCursor::SUIT_OverrideCursor( const QCursor& cursor )
11 {
12   QApplication::setOverrideCursor( cursor );
13 }
14
15 /*!Destructor. restoring override cursor.*/
16 SUIT_OverrideCursor::~SUIT_OverrideCursor()
17 {
18   QApplication::restoreOverrideCursor();
19 }
20
21 /*! Check cursors is empty */
22 bool SUIT_OverrideCursor::isActive() const
23 {
24   return myCursors.isEmpty();
25 }
26
27 /*!Suspend cursors.*/
28 void SUIT_OverrideCursor::suspend()
29 {
30   if ( !isActive() )
31     return;
32
33   while ( QApplication::overrideCursor() )
34   {
35     myCursors.prepend( *QApplication::overrideCursor() );
36     QApplication::restoreOverrideCursor();
37   }
38 }
39
40 /*!Resume cursors.*/
41 void SUIT_OverrideCursor::resume()
42 {
43   if ( isActive() )
44     return;
45
46   for ( QValueList<QCursor>::const_iterator it = myCursors.begin(); it != myCursors.end(); ++it )
47     QApplication::setOverrideCursor( *it );
48
49   myCursors.clear();
50 }