5 #include <QApplication>
8 * @short sets a cursor and makes sure it's restored on destruction
9 * Create a KCursorSaver object when you want to set the cursor.
10 * As soon as it gets out of scope, it will restore the original
16 /// constructor taking QCursor shapes
17 KCursorSaver(Qt::CursorShape shape
) {
18 QApplication::setOverrideCursor( QCursor(shape
) );
22 /// copy constructor. The right side won't restore the cursor
23 KCursorSaver( const KCursorSaver
&rhs
) {
27 /// restore the cursor
30 QApplication::restoreOverrideCursor();
33 /// call this to explitly restore the cursor
34 inline void restoreCursor(void) {
35 QApplication::restoreOverrideCursor();
40 void operator=( const KCursorSaver
&rhs
) {
50 * convenience functions
53 inline KCursorSaver
idle() {
54 return KCursorSaver(Qt::ArrowCursor
);
56 inline KCursorSaver
busy() {
57 return KCursorSaver(Qt::WaitCursor
);
61 #endif /*kbusyptr_h_*/