0
Я создал новый QWidget с помощью одной кнопки в Qt Designer и я добавил это к исходному коду:Кнопка не анимировать
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();
}
Когда я нажимаю на кнопку, она исчезает, и она не анимировать ,
Вы не должны установить соединение, чтобы удалить анимацию, когда она будет закончена. Просто установите политику удаления в QAbstractAnimation :: DeleteWhenStopped при вызове [start()] (http://qt-project.org/doc/qt-4.8/qabstractanimation.html#start). 'Animation-> начать (QAbstractAnimation :: DeleteWhenStopped)' – thuga