Gui::WaitCursor Class Reference

This class sets a waitcursor automatically while a slow operation is running. More...

#include <WaitCursor.h>

List of all members.

Public Types

enum  FilterEventsFlag { NoEvents = 0x00, KeyEvents = 0x01, MouseEvents = 0x02, AllEvents = KeyEvents | MouseEvents }

Public Member Functions

FilterEventsFlags ignoreEvents () const
void restoreCursor ()
 Restores the last cursor if needed.
void setIgnoreEvents (FilterEventsFlags flags=AllEvents)
void setWaitCursor ()
 Sets the wait cursor if needed.
 WaitCursor ()
 Constructs this object and shows the wait cursor immediately.
 ~WaitCursor ()
 Restores the last cursor again.

Detailed Description

This class sets a waitcursor automatically while a slow operation is running.

Therefore you just have to create an instance of WaitCursor before the time consuming operation starts.

 :
 WaitCursor ac;
 ...
 ...                   // slow operation
 ...

Sometimes you have two slow operations with some user interactions in between them. Avoiding to show the waiting cursor then you have to call the methods restoreCursor() and setWaitCursor manually, like:

 :
 WaitCursor ac;
 ...
 ...                   // 1st slow operation
 ac.restoreCursor();
 ...
 ...                  // some dialog stuff
 ac.setWaitCursor();
 ...
 ...                  // 2nd slow operation
Author:
Werner Mayer

Definition at line 61 of file WaitCursor.h.


Member Enumeration Documentation

Enumerator:
NoEvents 
KeyEvents 
MouseEvents 
AllEvents 

Definition at line 64 of file WaitCursor.h.


Constructor & Destructor Documentation

WaitCursor::WaitCursor (  ) 

Constructs this object and shows the wait cursor immediately.

If you need to open a dialog as long as an instance of WaitCursor exists you must call restoreCursor() before and setWaitCursor() afterwards because all key events and mouse button events are filtered, otherwise you will run into strange behaviour.

Definition at line 143 of file WaitCursor.cpp.

References setWaitCursor().

WaitCursor::~WaitCursor (  ) 

Restores the last cursor again.

Definition at line 150 of file WaitCursor.cpp.

References restoreCursor().


Member Function Documentation

WaitCursor::FilterEventsFlags WaitCursor::ignoreEvents (  )  const
void WaitCursor::restoreCursor (  ) 
void WaitCursor::setIgnoreEvents ( FilterEventsFlags  flags = AllEvents  ) 
void WaitCursor::setWaitCursor (  ) 

The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:05 2011 for FreeCAD by  doxygen 1.6.1