• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Kross

  • sources
  • kde-4.12
  • kdelibs
  • kross
  • ui
model.h
Go to the documentation of this file.
1 /***************************************************************************
2  * model.h
3  * This file is part of the KDE project
4  * copyright (C) 2006-2007 by Sebastian Sauer (mail@dipe.org)
5  *
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  ***************************************************************************/
19 
20 #ifndef KROSS_MODEL_H
21 #define KROSS_MODEL_H
22 
23 #include <kross/core/krossconfig.h>
24 
25 #include <QtCore/QModelIndex>
26 #include <QtGui/QSortFilterProxyModel>
27 
28 namespace Kross {
29 
30  // Forward declarations.
31  class Action;
32  class ActionCollection;
33  class ActionCollectionModelItem;
34 
46  class KROSSUI_EXPORT ActionCollectionModel : public QAbstractItemModel
47  {
48  Q_OBJECT
49  public:
50  enum Mode {
51  None = 0,
52  Icons = 1,
53  ToolTips = 2,
54  UserCheckable = 4
55  //Editable = 8
56  };
57 
58  explicit ActionCollectionModel(QObject* parent, ActionCollection* collection = 0, Mode mode = Mode(Icons|ToolTips));
59  virtual ~ActionCollectionModel();
60 
61  virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
62  virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
63  virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
64  virtual QModelIndex parent(const QModelIndex& index) const;
65  virtual Qt::ItemFlags flags(const QModelIndex &index) const;
66  virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
67  virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
68 
69  virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
70  virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
71  virtual bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex());
72  virtual bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex());
73 
74  //Qt::DropActions supportedDragActions() const;
75  virtual QStringList mimeTypes() const;
76  virtual QMimeData* mimeData(const QModelIndexList& indexes) const;
77  virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
78 
79  virtual Qt::DropActions supportedDropActions() const;
80 
81  QModelIndex indexForCollection( ActionCollection *collection ) const;
82  QModelIndex indexForAction( Action *action ) const;
84  ActionCollection *rootCollection() const;
85 
90  static Action* action(const QModelIndex& index);
91 
96  static ActionCollection* collection(const QModelIndex& index);
97 
98  protected:
100  int rowNumber( ActionCollection *collection ) const;
101 
102  private Q_SLOTS:
103  void slotUpdated();
104 
105  void slotDataChanged( ActionCollection* );
106  void slotDataChanged( Action* );
107 
108  void slotCollectionToBeInserted( ActionCollection* child, ActionCollection* parent );
109  void slotCollectionInserted( ActionCollection* child, ActionCollection* parent );
110  void slotCollectionToBeRemoved( ActionCollection* child, ActionCollection* parent );
111  void slotCollectionRemoved( ActionCollection* child, ActionCollection* parent );
112 
113  void slotActionToBeInserted( Action* child, ActionCollection* parent );
114  void slotActionInserted( Action* child, ActionCollection* parent );
115  void slotActionToBeRemoved( Action* child, ActionCollection* parent );
116  void slotActionRemoved( Action* child, ActionCollection* parent );
117  private:
119  class Private;
121  Private* const d;
122  };
123 
128  class KROSSUI_EXPORT ActionCollectionProxyModel : public QSortFilterProxyModel
129  {
130  public:
131  explicit ActionCollectionProxyModel(QObject* parent, ActionCollectionModel* model = 0);
132  virtual ~ActionCollectionProxyModel();
133 
134  private:
136  virtual void setSourceModel(QAbstractItemModel* sourceModel);
138  virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
139  };
140 
141 }
142 
143 #endif
144 
QVariant
Kross::ActionCollectionModel
The ActionCollectionModel class implements a QAbstractItemModel to provide a model for views of a Act...
Definition: model.h:46
QObject
Kross::ActionCollectionProxyModel
The ActionCollectionProxyModel class implements a QSortFilterProxyModel for a ActionCollectionModel i...
Definition: model.h:128
None
QStringList
Kross::ActionCollectionModel::Mode
Mode
Definition: model.h:50
Action
QAbstractItemModel
QSortFilterProxyModel
krossconfig.h
Kross::Action
The Action class is an abstract container to deal with scripts like a single standalone script file...
Definition: action.h:94
Kross::ActionCollection
The ActionCollection class manages collections of Action instances.
Definition: actioncollection.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal