Change cursor to hourglass/wait/busy cursor and back in Qt

随声附和 提交于 2019-12-03 00:58:50
Kamil Klimek

Qsiris solution is "widget wide". If you want to change cursor for your whole application then use

QApplication::setOverrideCursor(Qt::WaitCursor);

and

QApplication::restoreOverrideCursor();

Note: As @Ehsan Khodarahmi pointed out, the cursor will NOT change until triggering next QT event or calling QApplication::processEvents() manually.

Qsiris

Use this to set the cursor to wait when the process begins:

this->setCursor(Qt::WaitCursor);

And this to restore the cursor back to normal (put this in the slot for QProcess::finished)

this->setCursor(Qt::ArrowCursor);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!