开发者

QT progress bar speed

Does QT provide any functions to control a progress bar's speed? For example, if I want it to increase by 1% every 1 second, is there any QT way to d开发者_如何学Co it instead of using a loop and sleeping for 1 second between each value change?


You can use QTimeLine for this. The detailed description in the documentation gives an example of exactly what you want.


Use a QTimer.

Connect the signal timeout() to a slot that increases the value in the QProgressBar.

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(1000);

In this cas, update() will be call each second.


If you're using Qt 4.6 you can also use QPropertyAnimation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜