akonadi
22 #include "progressspinnerdelegate_p.h"
24 #include "entitytreemodel.h"
26 #include <QTimerEvent>
27 #include <QAbstractItemView>
29 using namespace Akonadi;
31 DelegateAnimator::DelegateAnimator(QAbstractItemView *view)
32 : QObject(view), m_view(view), m_timerId(-1)
34 m_pixmapSequence = KPixmapSequence(QLatin1String(
"process-working"), 22);
37 void DelegateAnimator::timerEvent(QTimerEvent* event)
39 if (!(event->timerId() == m_timerId && m_view))
40 return QObject::timerEvent(event);
43 foreach (
const Animation &animation, m_animations)
48 region += m_view->visualRect(animation.index);
51 m_view->viewport()->update(region);
54 QPixmap DelegateAnimator::sequenceFrame(
const QModelIndex& index)
56 foreach(
const Animation &animation, m_animations)
58 if (animation.index == index)
60 return m_pixmapSequence.frameAt(animation.frame);
67 ProgressSpinnerDelegate::ProgressSpinnerDelegate(DelegateAnimator *animator, QObject* parent)
68 : QStyledItemDelegate(parent), m_animator(animator)
73 void ProgressSpinnerDelegate::initStyleOption(QStyleOptionViewItem* option,
const QModelIndex& index)
const
75 QStyledItemDelegate::initStyleOption(option, index);
81 m_animator->pop(index);
87 m_animator->pop(index);
91 m_animator->push(index);
93 if (QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *>(option)) {
94 v4->icon = m_animator->sequenceFrame(index);
98 uint Akonadi::qHash(Akonadi::DelegateAnimator::Animation anim)
100 return qHash(anim.index);
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Nov 26 2012 16:48:20 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.