This class sets a waitcursor automatically while a slow operation is running. More...
#include <WaitCursor.h>
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. |
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
Definition at line 61 of file WaitCursor.h.
Definition at line 64 of file WaitCursor.h.
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().
WaitCursor::FilterEventsFlags WaitCursor::ignoreEvents | ( | ) | const |
Definition at line 172 of file WaitCursor.cpp.
References Gui::WaitCursorP::getInstance(), and Gui::WaitCursorP::ignoreEvents().
void WaitCursor::restoreCursor | ( | ) |
Restores the last cursor if needed.
Definition at line 167 of file WaitCursor.cpp.
References Gui::WaitCursorP::getInstance(), and Gui::WaitCursorP::setBusy().
Referenced by RobotGui::Workbench::activated(), Gui::Application::activateWorkbench(), Gui::Application::exportTo(), Gui::Application::importFrom(), Gui::Application::open(), Gui::Sequencer::pause(), and ~WaitCursor().
void WaitCursor::setIgnoreEvents | ( | FilterEventsFlags | flags = AllEvents |
) |
Definition at line 177 of file WaitCursor.cpp.
References Gui::WaitCursorP::getInstance(), and Gui::WaitCursorP::setIgnoreEvents().
void WaitCursor::setWaitCursor | ( | ) |
Sets the wait cursor if needed.
Definition at line 159 of file WaitCursor.cpp.
References Gui::WaitCursorP::getInstance(), and Gui::WaitCursorP::setBusy().
Referenced by RobotGui::Workbench::activated(), Gui::Application::activateWorkbench(), Gui::Application::exportTo(), Gui::Application::importFrom(), Gui::Application::open(), Gui::Sequencer::resume(), and WaitCursor().