mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Honor prefs.anim_speed on the ToolTip animations
The tooltip animation had a fixed animation speed, this patch honors the anim_speed on the preferences, and also disables the animation completely if the speed == 0. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
85909ca28d
commit
67865a86be
1 changed files with 18 additions and 10 deletions
|
@ -70,11 +70,15 @@ void ToolTipItem::collapse()
|
||||||
{
|
{
|
||||||
int dim = defaultIconMetrics().sz_small;
|
int dim = defaultIconMetrics().sz_small;
|
||||||
|
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
|
if (prefs.animation_speed) {
|
||||||
animation->setDuration(100);
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
|
||||||
animation->setStartValue(nextRectangle);
|
animation->setDuration(100);
|
||||||
animation->setEndValue(QRect(0, 0, dim, dim));
|
animation->setStartValue(nextRectangle);
|
||||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
animation->setEndValue(QRect(0, 0, dim, dim));
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
} else {
|
||||||
|
setRect(nextRectangle);
|
||||||
|
}
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
status = COLLAPSED;
|
status = COLLAPSED;
|
||||||
|
@ -115,11 +119,15 @@ void ToolTipItem::expand()
|
||||||
nextRectangle.setHeight(height);
|
nextRectangle.setHeight(height);
|
||||||
|
|
||||||
if (nextRectangle != rect()) {
|
if (nextRectangle != rect()) {
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
|
if (prefs.animation_speed) {
|
||||||
animation->setDuration(100);
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
|
||||||
animation->setStartValue(rect());
|
animation->setDuration(prefs.animation_speed);
|
||||||
animation->setEndValue(nextRectangle);
|
animation->setStartValue(rect());
|
||||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
animation->setEndValue(nextRectangle);
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
} else {
|
||||||
|
setRect(nextRectangle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = EXPANDED;
|
status = EXPANDED;
|
||||||
|
|
Loading…
Add table
Reference in a new issue