Slow down spinner

This commit is contained in:
Konstantinos Sideris 2017-07-02 16:44:05 +03:00
parent 06cacc13d1
commit 140cbd3c27
2 changed files with 9 additions and 5 deletions

View file

@ -46,6 +46,9 @@ private:
// Circle radius. // Circle radius.
int size_; int size_;
// Animation duration.
int duration_;
}; };
class CircularProgressDelegate : public QObject class CircularProgressDelegate : public QObject

View file

@ -11,6 +11,7 @@ CircularProgress::CircularProgress(QWidget *parent)
, progress_type_{ui::ProgressType::IndeterminateProgress} , progress_type_{ui::ProgressType::IndeterminateProgress}
, width_{6.25} , width_{6.25}
, size_{64} , size_{64}
, duration_{3050}
{ {
delegate_ = new CircularProgressDelegate(this); delegate_ = new CircularProgressDelegate(this);
@ -24,11 +25,11 @@ CircularProgress::CircularProgress(QWidget *parent)
length_animation->setTargetObject(delegate_); length_animation->setTargetObject(delegate_);
length_animation->setEasingCurve(QEasingCurve::InOutQuad); length_animation->setEasingCurve(QEasingCurve::InOutQuad);
length_animation->setStartValue(0.1); length_animation->setStartValue(0.1);
length_animation->setKeyValueAt(0.15, 0.2); length_animation->setKeyValueAt(0.15, 3);
length_animation->setKeyValueAt(0.6, 20); length_animation->setKeyValueAt(0.6, 20);
length_animation->setKeyValueAt(0.7, 20); length_animation->setKeyValueAt(0.7, 20);
length_animation->setEndValue(20); length_animation->setEndValue(20);
length_animation->setDuration(2050); length_animation->setDuration(duration_);
auto offset_animation = new QPropertyAnimation(this); auto offset_animation = new QPropertyAnimation(this);
offset_animation->setPropertyName("dashOffset"); offset_animation->setPropertyName("dashOffset");
@ -39,14 +40,14 @@ CircularProgress::CircularProgress(QWidget *parent)
offset_animation->setKeyValueAt(0.6, -7); offset_animation->setKeyValueAt(0.6, -7);
offset_animation->setKeyValueAt(0.7, -7); offset_animation->setKeyValueAt(0.7, -7);
offset_animation->setEndValue(-25); offset_animation->setEndValue(-25);
offset_animation->setDuration(2050); offset_animation->setDuration(duration_);
auto angle_animation = new QPropertyAnimation(this); auto angle_animation = new QPropertyAnimation(this);
angle_animation->setPropertyName("angle"); angle_animation->setPropertyName("angle");
angle_animation->setTargetObject(delegate_); angle_animation->setTargetObject(delegate_);
angle_animation->setStartValue(0); angle_animation->setStartValue(0);
angle_animation->setEndValue(719); angle_animation->setEndValue(360);
angle_animation->setDuration(2050); angle_animation->setDuration(duration_);
group->addAnimation(length_animation); group->addAnimation(length_animation);
group->addAnimation(offset_animation); group->addAnimation(offset_animation);