Delay in QtWidget
-
Hi i am trying to write a simple code for drawPoint , but not able to get the delay. Here is simple code which i have written.
include two header files
#include<QTime>
#include<QCoreApplication>void Mainwindow::delay(double sec)
{
QTime dieTime= QTime::currentTime().addSecs(sec);
while (QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}calling delay using : delay(n) //n is seconds..
Not able to get delay..
-
Thank for the reply..
I want to create simple animation in Qt for my students. I have used this->msleep(100); , but I am geeting error"Program has terminated unexpectedly".
I just want draw a point in for loop with some delay in order to show animation.
-
Thank for the reply..
I want to create simple animation in Qt for my students. I have used this->msleep(100); , but I am geeting error"Program has terminated unexpectedly".
I just want draw a point in for loop with some delay in order to show animation.
@KunalShah_4 You should take a look at http://doc.qt.io/qt-5/animation.html