1
/* This file is part of the KDE project
2
* Copyright (C) 2012 Paul Mendez <paulestebanms@gmail.com>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library 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 GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public License
15
* along with this library; see the file COPYING.LIB. If not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
20
// Heavily based in CollectionItemModel work of Peter Simonsson <peter.simonsson@gmail.com>
22
#ifndef KPRCOLLECTIONITEMMODEL_H
23
#define KPRCOLLECTIONITEMMODEL_H
25
#include <QAbstractItemModel>
29
#include <KoXmlReader.h>
32
* Struct containing the information stored in CollectionItemModel item
34
struct KPrCollectionItem
36
QString id; //animation id
37
QString name; //animation name (text to be displayed on animations view)
38
QString toolTip; // text of animation tool tip
39
QIcon icon; // icon of the animation type
40
KoXmlElement animationContext; //xml data used to instantiate animations of this type
43
/** Model used to store predefined animations data */
44
class KPrCollectionItemModel : public QAbstractListModel
48
KPrCollectionItemModel(QObject* parent = 0);
50
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
51
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
52
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
55
* @brief Set the list of KoCollectionItem to be stored in the model
57
* @param List of KPrCollectionItem
59
void setAnimationClassList(const QList<KPrCollectionItem> &newlist);
61
QList<KPrCollectionItem> animationClassList() const {return m_animationClassList;}
64
* @brief Return the xml context for the animation on index
66
* @param index of the animation
68
KoXmlElement animationContext(const QModelIndex &index) const;
71
QList<KPrCollectionItem> m_animationClassList;
74
#endif // KPRCOLLECTIONITEMMODEL_H