I am using a QTimer and connecting its timeout signal to the method animate(). In animate(), I am displaying a QPushButton at different positions using a loop. The problem is that the QPushButton is not visible till the loop is finished. It should be giving the effect of a moving object. The following is Qt Jambi code :
QTimer t=new QTimer();
t.timeout.connect(this,tr("animate()"));
t.setSingleShot(true);
t.start(0);
The following is the animate() function :
void animate()
{
QPushButton a=new QPushButton(new QIcon("../Desktop/images/kya/32x32/down.png"),new String().format("%.1f",browser.page().totalBytes()/1024.0)+" KB");
a.setFont(new QFont("Impact",20,QFont.Weight.Light.value()));
int x,y,bx=130,by=50; //bx and by are the width and height of the pushbutton
a.setEnabled(false);
a.show();
for (x=QApplication.desktop().width()-bx,y=QApplication.desktop().height()/2+80;y<QApplication.desktop().height()-by;y+=5)
{
try{Thread.sleep(100);}catch(Exception e){System.out.println(e);}
a.setGeometry(x,y,bx,by);
a.update(x,y,bx,by);
a.show();
}
}