将光标更改为沙漏/等待/忙碌光标,然后返回Qt [英] Change cursor to hourglass/wait/busy cursor and back in Qt
本文介绍了将光标更改为沙漏/等待/忙碌光标,然后返回Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我产生一个执行长时间操作的进程,我想给出视觉反馈,发生了一些事情,所以我想将光标改为忙,并在我收到 QProcess :: finished
信号。
I spawn a process that performs a lengthy operation, and I'd like to give visual feedback that something is happening, so I want to change the cursor to busy and restore it when I receive the QProcess::finished
signal.
推荐答案
Qsiris解决方案是widget宽。如果你想为整个应用程序更改游标,请使用
Qsiris solution is "widget wide". If you want to change cursor for your whole application then use
QApplication::setOverrideCursor(Qt::WaitCursor);
和
QApplication::restoreOverrideCursor();
注意:@Ehsan Khodarahmi指出,直到触发下一个QT事件或手动调用QApplication :: processEvents()。
Note: As @Ehsan Khodarahmi pointed out, the cursor will NOT change until triggering next QT event or calling QApplication::processEvents() manually.
这篇关于将光标更改为沙漏/等待/忙碌光标,然后返回Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文