1
/***************************************************************************
3
* This file is part of the KDE project
4
* copyright (C) 2006 by Sebastian Sauer (mail@dipe.org)
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* 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 program; see the file COPYING. If not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
18
***************************************************************************/
23
#include "krossconfig.h"
24
//#include "../core/action.h"
26
#include <QAbstractItemModel>
27
#include <QSortFilterProxyModel>
31
// Forward declarations.
33
class ActionCollection;
36
* The ActionCollectionModel class implements a QAbstractItemModel to provide
37
* a model for views of a \a ActionCollection instance that manages a
38
* collection of \a Action instances.
40
class KROSSCORE_EXPORT ActionCollectionModel : public QAbstractItemModel
51
explicit ActionCollectionModel(QObject* parent, ActionCollection* collection = 0, Mode mode = Mode(Icons|ToolTips));
52
virtual ~ActionCollectionModel();
54
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
55
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
56
virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
57
virtual QModelIndex parent(const QModelIndex& index) const;
58
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
59
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
60
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
62
virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
63
virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
64
virtual bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex());
65
virtual bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex());
67
//Qt::DropActions supportedDragActions() const;
68
virtual QStringList mimeTypes() const;
69
virtual QMimeData* mimeData(const QModelIndexList& indexes) const;
70
virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
72
virtual Qt::DropActions supportedDropActions() const;
74
static Action* action(const QModelIndex& index);
75
static ActionCollection* collection(const QModelIndex& index);
79
/// \internal d-pointer class.
81
/// \internal d-pointer instance.
86
* The ActionCollectionProxyModel class implements a QSortFilterProxyModel
87
* for a \a ActionCollectionModel instance.
89
class KROSSCORE_EXPORT ActionCollectionProxyModel : public QSortFilterProxyModel
92
ActionCollectionProxyModel(QObject* parent, ActionCollectionModel* model = 0);
93
virtual ~ActionCollectionProxyModel();
96
virtual void setSourceModel(QAbstractItemModel* sourceModel);
97
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;