Regarding displaying busy cursor
-
wrote on 21 Sept 2011, 09:11 last edited by
Hi All
I was performing some task in for loop so i want to display the cursor in busy mode untill that for loop is executed completly.
I tried something like this@for(int i=0;i<size;i++)
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
.
.
.
.
}
QApplication::restoreOverrideCursor();
@But in above case the cursor remains in busy state even after the loop is completed.
How to reslove this?
How to implement this? -
wrote on 21 Sept 2011, 09:18 last edited by
The cursor is pushed onto a stack, so you need to call restoreOverrideCursor as often as you did a setOverrideCursor. Check the documentation of those methods, it explains it.
Move the setOverrideCursor outside of the loop.
-
wrote on 21 Sept 2011, 09:23 last edited by
In my opinion, setOverrideCursor is corresponding to restoreOverrideCursor,
so you can either@
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
for(int i=0;i<size;i++) {
.
.
.
}
QApplication::restoreOverrideCursor();
@
or
@
for(int i=0;i<size;i++) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
.
.
.
QApplication::restoreOverrideCursor();
}
@
1/3