-// File : QAD_WaitCursor.h
-// Created : 02/10/2002
-// Descr : Use this class to set wait cursor on long operatins
-
-// Author : Vadim SANDLER
-// Project : SALOME Pro
-// Module : SALOMEGUI
-// Copyright : Open CASCADE
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : QAD_WaitCursor.h
+// Author : Vadim SANDLER
+// Module : SALOME
// $Header$
#ifndef QAD_WAITCURSOR_H
class QAD_EXPORT QAD_WaitCursor {
public:
// constructor
- QAD_WaitCursor() : myStarted(false) { start(); }
+ QAD_WaitCursor() : myStarted( false ), myDepth( 1 ) { start(); }
// destructor
- ~QAD_WaitCursor() { stop(); }
+ ~QAD_WaitCursor() { if ( !myStarted ) { myDepth--; start(); } else { QApplication::restoreOverrideCursor(); } }
// sets WAIT cursor if not set yet
- void start() { if (!myStarted) { QApplication::setOverrideCursor(Qt::waitCursor); myStarted = true; } }
+ void start() { if ( !myStarted ) { while( myDepth-- ) QApplication::setOverrideCursor( Qt::waitCursor ); myStarted = true; } myDepth = 0; }
// clears WAIT cursor if set
- void stop() { if (myStarted) { QApplication::restoreOverrideCursor(); myStarted = false; } }
+ void stop() { if ( myStarted ) { while( QApplication::overrideCursor() ) { QApplication::restoreOverrideCursor(); myDepth++; } myStarted = false; } }
// returns true if WAIT cursor is active
bool isStarted() { return myStarted; }
private:
bool myStarted;
+ int myDepth;
};
#endif