Changeset View
Changeset View
Standalone View
Standalone View
stage/part/tools/animationtool/KPrCollectionItemModel.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include "KPrCollectionItemModel.h" | 22 | #include "KPrCollectionItemModel.h" | ||
23 | 23 | | |||
24 | #include "StageDebug.h" | 24 | #include "StageDebug.h" | ||
25 | 25 | | |||
26 | KPrCollectionItemModel::KPrCollectionItemModel(QObject* parent) | 26 | KPrCollectionItemModel::KPrCollectionItemModel(QObject* parent) | ||
27 | : QAbstractListModel(parent) | 27 | : QAbstractListModel(parent) | ||
28 | { | 28 | { | ||
29 | setSupportedDragActions(Qt::IgnoreAction); | 29 | } | ||
30 | | ||||
31 | Qt::DropActions KPrCollectionItemModel::supportedDragActions() const | ||||
32 | { | ||||
33 | return Qt::IgnoreAction; | ||||
30 | } | 34 | } | ||
31 | 35 | | |||
32 | QVariant KPrCollectionItemModel::data(const QModelIndex &index, int role) const | 36 | QVariant KPrCollectionItemModel::data(const QModelIndex &index, int role) const | ||
33 | { | 37 | { | ||
34 | if (!index.isValid() || index.row() > m_animationClassList.count()) | 38 | if (!index.isValid() || index.row() > m_animationClassList.count()) | ||
35 | return QVariant(); | 39 | return QVariant(); | ||
36 | 40 | | |||
37 | switch(role) | 41 | switch(role) | ||
Show All 20 Lines | |||||
58 | int KPrCollectionItemModel::rowCount(const QModelIndex &parent) const | 62 | int KPrCollectionItemModel::rowCount(const QModelIndex &parent) const | ||
59 | { | 63 | { | ||
60 | Q_UNUSED(parent); | 64 | Q_UNUSED(parent); | ||
61 | return m_animationClassList.count(); | 65 | return m_animationClassList.count(); | ||
62 | } | 66 | } | ||
63 | 67 | | |||
64 | void KPrCollectionItemModel::setAnimationClassList(const QVector<KPrCollectionItem> &newlist) | 68 | void KPrCollectionItemModel::setAnimationClassList(const QVector<KPrCollectionItem> &newlist) | ||
65 | { | 69 | { | ||
70 | beginResetModel(); | ||||
66 | m_animationClassList = newlist; | 71 | m_animationClassList = newlist; | ||
67 | reset(); | 72 | endResetModel(); | ||
68 | } | 73 | } | ||
69 | 74 | | |||
70 | KoXmlElement KPrCollectionItemModel::animationContext(const QModelIndex &index) const | 75 | KoXmlElement KPrCollectionItemModel::animationContext(const QModelIndex &index) const | ||
71 | { | 76 | { | ||
72 | return m_animationClassList.value(index.row()).animationContext; | 77 | return m_animationClassList.value(index.row()).animationContext; | ||
73 | } | 78 | } | ||
74 | 79 | | |||
75 | Qt::ItemFlags KPrCollectionItemModel::flags(const QModelIndex &index) const | 80 | Qt::ItemFlags KPrCollectionItemModel::flags(const QModelIndex &index) const | ||
76 | { | 81 | { | ||
77 | return QAbstractListModel::flags(index); | 82 | return QAbstractListModel::flags(index); | ||
78 | } | 83 | } |