Regarding displaying busy cursor
-
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? -
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.
-
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();
}
@