1 /***************************************************************************
2 * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef KITEMLISTVIEWANIMATION_H
21 #define KITEMLISTVIEWANIMATION_H
23 #include "dolphin_export.h"
30 class QGraphicsWidget
;
31 class QPropertyAnimation
;
34 * @brief Internal helper class for KItemListView to animate the items.
36 * Supports item animations for moving, creating, deleting and resizing
37 * an item. Several applications can be applied to one item in parallel.
39 class DOLPHIN_EXPORT KItemListViewAnimation
: public QObject
51 KItemListViewAnimation(QObject
* parent
= nullptr);
52 ~KItemListViewAnimation() override
;
54 void setScrollOrientation(Qt::Orientation orientation
);
55 Qt::Orientation
scrollOrientation() const;
57 void setScrollOffset(qreal scrollOffset
);
58 qreal
scrollOffset() const;
61 * Starts the animation of the type \a type for the widget \a widget. If an animation
62 * of the type is already running, this animation will be stopped before starting
65 void start(QGraphicsWidget
* widget
, AnimationType type
, const QVariant
& endValue
= QVariant());
68 * Stops the animation of the type \a type for the widget \a widget.
70 void stop(QGraphicsWidget
* widget
, AnimationType type
);
73 * Stops all animations that have been applied to the widget \a widget.
75 void stop(QGraphicsWidget
* widget
);
78 * @return True if the animation of the type \a type has been started
79 * for the widget \a widget..
81 bool isStarted(QGraphicsWidget
*widget
, AnimationType type
) const;
84 * @return True if any animation has been started for the widget.
86 bool isStarted(QGraphicsWidget
* widget
) const;
89 void finished(QGraphicsWidget
* widget
, KItemListViewAnimation::AnimationType type
);
95 enum { AnimationTypeCount
= 4 };
97 Qt::Orientation m_scrollOrientation
;
99 QHash
<QGraphicsWidget
*, QPropertyAnimation
*> m_animation
[AnimationTypeCount
];