1 /***************************************************************************
2 * Copyright (C) 2012 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 KSTANDARDITEMMODEL_H
21 #define KSTANDARDITEMMODEL_H
23 #include <libdolphin_export.h>
24 #include <kitemviews/kitemmodelbase.h>
31 * @brief Model counterpart for KStandardItemView.
33 * Allows to add items to the model in an easy way by the
34 * class KStandardItem.
38 class LIBDOLPHINPRIVATE_EXPORT KStandardItemModel
: public KItemModelBase
43 explicit KStandardItemModel(QObject
* parent
= 0);
44 virtual ~KStandardItemModel();
46 void insertItem(int index
, KStandardItem
* item
);
47 void replaceItem(int index
, KStandardItem
* item
);
48 void appendItem(KStandardItem
* item
);
49 void removeItem(int index
);
50 KStandardItem
* item(int index
) const;
51 int index(const KStandardItem
* item
) const;
53 virtual int count() const;
54 virtual QHash
<QByteArray
, QVariant
> data(int index
) const;
55 virtual bool setData(int index
, const QHash
<QByteArray
, QVariant
>& values
);
56 virtual QMimeData
* createMimeData(const QSet
<int>& indexes
) const;
57 virtual int indexForKeyboardSearch(const QString
& text
, int startFromIndex
= 0) const;
58 virtual bool supportsDropping(int index
) const;
59 virtual QString
roleDescription(const QByteArray
& role
) const;
60 virtual QList
<QPair
<int, QVariant
> > groups() const;
63 QList
<KStandardItem
*> m_items
;
64 QHash
<const KStandardItem
*, int> m_indexesForItems
;