delete image after 5 sec using qt creator -
i loaded image using qt creator c++ :
inputimg=new qimage("c:/bimap/hud1.bmp")
and can see on window. want delete image after 5 sec , load image.
is possible it? answer.
allocate images in constructor (or @ least once), , use index select them.
added numimages
variable, can have more 2 images rotate through.
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); qtimer *timer = new qtimer(this); connect(timer, signal(timeout()), this, slot(update())); timer->start(5000); index = 0; numimages = 2; inputimages[0] = new qimage("c:/bimap/hud1.bmp"); inputimages[1] = new qimage("c:/bimap/speed.bmp"); } void mainwindow::update() { showimage(inputimages[index]); index = ++index % numimages; }
Comments
Post a Comment