akonadi
22 #ifndef PROGRESSSPINNERDELEGATE_P_H
23 #define PROGRESSSPINNERDELEGATE_P_H
25 #include <QStyledItemDelegate>
28 #include <kpixmapsequence.h>
32 class DelegateAnimator :
public QObject
36 DelegateAnimator(QAbstractItemView *view);
38 void push(
const QModelIndex &index) {
39 if (m_animations.isEmpty())
40 m_timerId = startTimer(200);
41 m_animations.insert(Animation(index));
43 void pop(
const QModelIndex &index) {
44 m_animations.remove(Animation(index));
45 if (m_animations.isEmpty() && m_timerId != -1) {
51 QPixmap sequenceFrame(
const QModelIndex &index);
53 static const int sCount = 7;
55 inline Animation(
const QPersistentModelIndex &idx)
56 : frame(0), index(idx)
60 bool operator==(
const Animation &other)
const
61 {
return index == other.index; }
64 inline void animate()
const { frame = ( frame + 1 ) % sCount; }
66 QPersistentModelIndex index;
70 virtual void timerEvent(QTimerEvent *event);
74 mutable QSet<Animation> m_animations;
75 QAbstractItemView *m_view;
76 KPixmapSequence m_pixmapSequence;
80 uint qHash(Akonadi::DelegateAnimator::Animation anim);
85 class ProgressSpinnerDelegate :
public QStyledItemDelegate
89 explicit ProgressSpinnerDelegate(DelegateAnimator *animator, QObject* parent = 0);
92 virtual void initStyleOption(QStyleOptionViewItem* option,
const QModelIndex& index)
const;
95 DelegateAnimator *m_animator;
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue Dec 11 2012 12:14:33 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.