Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
hierarchymodel.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: hierarchymodel.h
3//-----------------------------------------------------------------------------
4// Project: Kactus2
5// Author: Antti Kamppi
6// Date: 01.07.2011
7//
8// Description:
9// Contains the items to display the library component hierarchy to user.
10//-----------------------------------------------------------------------------
11
12#ifndef HIERARCHYMODEL_H
13#define HIERARCHYMODEL_H
14
15#include "hierarchyitem.h"
16
17#include <KactusAPI/KactusAPIGlobal.h>
18
19#include <QAbstractItemModel>
20#include <QSharedPointer>
21
23class LibraryData;
24
25//-----------------------------------------------------------------------------
27//-----------------------------------------------------------------------------
28class KACTUS2_API HierarchyModel : public QAbstractItemModel
29{
30 Q_OBJECT
31
32public:
33
41
48
50 virtual ~HierarchyModel() = default;
51
60 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
61
69 virtual int columnCount(QModelIndex const& parent = QModelIndex()) const;
70
77 virtual int rowCount(QModelIndex const& parent = QModelIndex()) const;
78
87 virtual QModelIndex index(int row, int column, QModelIndex const& parent = QModelIndex()) const;
88
95 virtual QModelIndex parent(QModelIndex const& child) const;
96
104 virtual QVariant data(QModelIndex const& index, int role = Qt::DisplayRole) const;
105
112 virtual bool hasChildren(QModelIndex const& parent = QModelIndex()) const;
113
120 Qt::ItemFlags flags(QModelIndex const& index) const;
121
128 QModelIndex index(HierarchyItem* item) const;
129
140 int referenceCount(VLNV const& vlnv) const;
141
152 virtual int getOwners(QList<VLNV>& list, VLNV const& vlnvToSearch) const;
153
160 QModelIndexList findIndexes(VLNV const& vlnv);
161
168 void getChildren(QList<VLNV>& childList, VLNV const& owner) const;
169
170public slots:
171
174
176 void onOpenDesign(QModelIndex const& index);
177
179 void onOpenMemoryDesign(QModelIndex const& index);
180
182 void onOpenItem(QModelIndex const& index);
183
185 void onCreateNewDesign(QModelIndex const& index);
186
188 void onCreateNewSWDesign(QModelIndex const& index);
189
191 void onCreateNewSystemDesign(QModelIndex const& index);
192
194 void onCreateNewAbsDef(QModelIndex const& index);
195
197 void onExportItem(QModelIndex const& index);
198
200 void onDeleteItem(QModelIndex const& index);
201
203 void onShowErrors(QModelIndex const& index);
204
206 void onRemoveVLNV(VLNV const& vlnv);
207
214 void onDocumentUpdated(VLNV const& vlnv);
215
216signals:
217
219 void errorMessage(const QString& msg);
220
222 void noticeMessage(const QString& msg);
223
225 void openDesign(VLNV const& vlnv, const QString& viewName);
226
228 void openMemoryDesign(VLNV const& vlnv, const QString& viewName);
229
231 void openSWDesign(VLNV const& vlnv, const QString& viewName);
232
234 void openSystemDesign(VLNV const& vlnv, const QString& viewName);
235
237 void editItem(VLNV const& vlnv);
238
240 void createAbsDef(VLNV const& busDefVLNV);
241
243 void createDesign(VLNV const& vlnv);
244
246 void createSWDesign(VLNV const& vlnv);
247
249 void createSystemDesign(VLNV const& vlnv);
250
252 void exportItem(VLNV const& vlnv);
253
255 void removeVLNV(QList<VLNV> vlnv);
256
258 void showErrors(VLNV const& vlnv);
259
262
263private:
265 HierarchyModel(const HierarchyModel& other);
266
268 HierarchyModel& operator=(const HierarchyModel& other);
269
271 HierarchyItem* rootItem_;
272
274 LibraryInterface* handler_;
275};
276
277#endif // HIERARCHYMODEL_H
Represents a single component in the library in hierarchy view.
void onCreateNewSWDesign(QModelIndex const &index)
Create new SW design.
void noticeMessage(const QString &msg)
Send a notification to be printed to user.
void exportItem(VLNV const &vlnv)
Export an item to a new location.
QModelIndexList findIndexes(VLNV const &vlnv)
virtual QModelIndex index(int row, int column, QModelIndex const &parent=QModelIndex()) const
void getChildren(QList< VLNV > &childList, VLNV const &owner) const
virtual QModelIndex parent(QModelIndex const &child) const
void openSWDesign(VLNV const &vlnv, const QString &viewName)
Open the SW design of a component.
void onOpenItem(QModelIndex const &index)
Open the selected component.
Qt::ItemFlags flags(QModelIndex const &index) const
Column
Defines the columns for the model.
void showErrors(VLNV const &vlnv)
Shows errors about the item at the given index.
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
virtual int columnCount(QModelIndex const &parent=QModelIndex()) const
void onExportItem(QModelIndex const &index)
When export is selected in search view.
void removeVLNV(QList< VLNV > vlnv)
Remove the specified VLNV from the library.
void editItem(VLNV const &vlnv)
Open the component in a component editor.
void errorMessage(const QString &msg)
Send an error message to be printed to user.
void onResetModel()
Reset the model.
void openSystemDesign(VLNV const &vlnv, const QString &viewName)
Open the system design of a component.
void openDesign(VLNV const &vlnv, const QString &viewName)
Open the design of a component.
void onDocumentUpdated(VLNV const &vlnv)
QModelIndex index(HierarchyItem *item) const
void openMemoryDesign(VLNV const &vlnv, const QString &viewName)
Open the memory design of a component.
void onCreateNewAbsDef(QModelIndex const &index)
Create new abstraction definition.
void createDesign(VLNV const &vlnv)
Create new design with given vlnv.
void createSWDesign(VLNV const &vlnv)
Create new SW design with given vlnv.
void createSystemDesign(VLNV const &vlnv)
Create new system design with given vlnv.
virtual bool hasChildren(QModelIndex const &parent=QModelIndex()) const
void onRemoveVLNV(VLNV const &vlnv)
Remove the specified vlnv from the tree.
virtual int rowCount(QModelIndex const &parent=QModelIndex()) const
int referenceCount(VLNV const &vlnv) const
virtual QVariant data(QModelIndex const &index, int role=Qt::DisplayRole) const
void onOpenMemoryDesign(QModelIndex const &index)
Open the memory design of the selected design.
void onCreateNewDesign(QModelIndex const &index)
Create new design.
virtual int getOwners(QList< VLNV > &list, VLNV const &vlnvToSearch) const
void onDeleteItem(QModelIndex const &index)
When delete is selected.
void invalidateFilter()
Refresh the item filtering because changes have been made.
void onCreateNewSystemDesign(QModelIndex const &index)
Create new system design.
virtual ~HierarchyModel()=default
The destructor.
void onShowErrors(QModelIndex const &index)
Shows errors about the item at the given index.
HierarchyModel(LibraryInterface *handler, QObject *parent)
void onOpenDesign(QModelIndex const &index)
Open the selected hierarchical design.
void createAbsDef(VLNV const &busDefVLNV)
Create a new abstraction definition for given bus definition.
LibraryInterface defines an interface to operate the IP-XACT-library.