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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • kasten
  • controllers
  • view
  • structures
structtreemodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Okteta Kasten Framework, made within the KDE community.
3  *
4  * Copyright 2009, 2011 Alex Richardson <alex.richardson@gmx.de>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) version 3, or any
10  * later version accepted by the membership of KDE e.V. (or its
11  * successor approved by the membership of KDE e.V.), which shall
12  * act as a proxy defined in Section 6 of version 3 of the license.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef STRUCTTREEMODEL_H_
24 #define STRUCTTREEMODEL_H_
25 
26 #include <QtCore/QAbstractItemModel>
27 #include <QtCore/QSet>
28 
29 class DataInformationBase;
30 class DataInformation;
31 
32 namespace Kasten2
33 {
34 class StructTool;
35 
36 class StructTreeModel: public QAbstractItemModel
37 {
38 Q_OBJECT
39 public:
40  explicit StructTreeModel(StructTool* tool, QObject* parent = NULL);
41  virtual ~StructTreeModel();
42  QVariant data(const QModelIndex& index, int role) const;
43  Qt::ItemFlags flags(const QModelIndex& index) const;
44  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
45  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
46  QModelIndex parent(const QModelIndex& index) const;
47  int rowCount(const QModelIndex& parent = QModelIndex()) const;
48  int columnCount(const QModelIndex& parent = QModelIndex()) const;
49  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
50  virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const;
51 private:
52  QModelIndex findItemInModel(DataInformationBase* data) const;
53 public Q_SLOTS:
54  void onToolDataChange(int row, void* data);
55  void onToolDataClear();
56  void onChildrenAboutToBeRemoved(DataInformation* sender, uint startIndex, uint endIndex);
57  void onChildrenAboutToBeInserted(DataInformation* sender, uint startIndex, uint endIndex);
58  void onChildrenRemoved(const DataInformation* sender, uint startIndex, uint endIndex);
59  void onChildrenInserted(const DataInformation* sender, uint startIndex, uint endIndex);
60 private:
61  StructTool* mTool;
62  //just for checking in debug mode:
63  DataInformation* mLastSender;
64  uint mLastStartIndex;
65  uint mLastEndIndex;
66 };
67 }
68 #endif /* STRUCTTREEMODEL_H_ */
Kasten2::StructTreeModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: structtreemodel.cpp:139
DataInformation
Interface that must be implemented by all datatypes.
Definition: datainformation.h:67
Kasten2::StructTreeModel::onChildrenAboutToBeRemoved
void onChildrenAboutToBeRemoved(DataInformation *sender, uint startIndex, uint endIndex)
Definition: structtreemodel.cpp:79
Kasten2::StructTreeModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: structtreemodel.cpp:219
Kasten2::StructTreeModel::onChildrenInserted
void onChildrenInserted(const DataInformation *sender, uint startIndex, uint endIndex)
Definition: structtreemodel.cpp:67
Kasten2::StructTreeModel::~StructTreeModel
virtual ~StructTreeModel()
Definition: structtreemodel.cpp:51
Kasten2::StructTreeModel::onChildrenRemoved
void onChildrenRemoved(const DataInformation *sender, uint startIndex, uint endIndex)
Definition: structtreemodel.cpp:55
Kasten2::StructTreeModel::onToolDataChange
void onToolDataChange(int row, void *data)
Definition: structtreemodel.cpp:255
QObject
Kasten2::StructTreeModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: structtreemodel.cpp:168
Kasten2::StructTreeModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: structtreemodel.cpp:105
Kasten2::StructTreeModel::parent
QModelIndex parent(const QModelIndex &index) const
Definition: structtreemodel.cpp:202
Kasten2::StructTreeModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: structtreemodel.cpp:178
Kasten2::StructTreeModel::onChildrenAboutToBeInserted
void onChildrenAboutToBeInserted(DataInformation *sender, uint startIndex, uint endIndex)
Definition: structtreemodel.cpp:92
Kasten2::StructTreeModel::StructTreeModel
StructTreeModel(StructTool *tool, QObject *parent=NULL)
Definition: structtreemodel.cpp:35
QAbstractItemModel
Kasten2::StructTreeModel::onToolDataClear
void onToolDataClear()
Definition: structtreemodel.cpp:260
Kasten2::StructTreeModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: structtreemodel.cpp:160
Kasten2::StructTreeModel
Definition: structtreemodel.h:36
DataInformationBase
Definition: datainformationbase.h:44
Kasten2::StructTool
Definition: structtool.h:49
Kasten2::StructTreeModel::hasChildren
virtual bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Definition: structtreemodel.cpp:235
Kasten2::StructTreeModel::data
QVariant data(const QModelIndex &index, int role) const
Definition: structtreemodel.cpp:111
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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