I created a new QWidget with a single button in Qt Designer and i added this to the source code :
void MainWindow::startAnimation()
{
QPropertyAnimation animation(ui->pushButton, "geometry");
animation.setDuration(3000);
animation.setStartValue(QRect(this->x(),this->y(),this->width(),this->height()));
animation.setEndValue(QRect(this->x(),this->y(), 10,10));
animation.setEasingCurve(QEasingCurve::OutBounce);
animation.start();
}
void MainWindow::on_pushButton_clicked()
{
startAnimation();
}
When I click on the button, it disappears and it doesn't animate.