HAL
module_item.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include "hal_core/defines.h"
30 
31 
32 #include <QColor>
33 #include <QList>
34 #include <QString>
35 #include <QVariant>
36 
37 namespace hal
38 {
39  class ModuleModel;
40 
47  class ModuleItem : public BaseTreeItem
48  {
49  public:
53  enum class TreeItemType {Module, Gate, Net};
54 
62  void setData(QList<QVariant> data) override;
69  void setDataAtIndex(int index, QVariant& data) override;
73  void appendData(QVariant data) override;
79  int getColumnCount() const override;
80 
88  ModuleItem(const u32 id, const TreeItemType type, ModuleModel* model);
89 
95  virtual ~ModuleItem();
96 
103  void appendExistingChildIfAny(const QMap<u32,ModuleItem*>& moduleMap);
104 
111  QVariant getData(int column) const override;
112 
118  QString name() const;
119 
125  u32 id() const;
126 
132  bool highlighted() const;
133 
139  bool isToplevelItem() const;
140 
146  TreeItemType getType() const;
147 
153  void setName(const QString& name);
154 
159  void setModuleType(const QString& moduleType);
160 
167  void setHighlighted(const bool highlighted);
168 
169  private:
170  u32 mId;
171  TreeItemType mItemType;
172  QString mName;
173  QString mModuleType;
174 
175  bool mHighlighted;
176  ModuleModel* mModuleModel; // reference to parent model
177  };
178 }
(Future) Base class for all tree models related to the details widget.
An item in the ModuleModel.
Definition: module_item.h:48
void setDataAtIndex(int index, QVariant &data) override
QVariant getData(int column) const override
Definition: module_item.cpp:88
void appendExistingChildIfAny(const QMap< u32, ModuleItem * > &moduleMap)
Definition: module_item.cpp:60
void setHighlighted(const bool highlighted)
void setData(QList< QVariant > data) override
bool isToplevelItem() const
int getColumnCount() const override
void appendData(QVariant data) override
void setName(const QString &name)
u32 id() const
QString name() const
bool highlighted() const
virtual ~ModuleItem()
Definition: module_item.cpp:48
TreeItemType getType() const
void setModuleType(const QString &moduleType)
Definition: module_item.cpp:79
ModuleItem(const u32 id, const TreeItemType type, ModuleModel *model)
Definition: module_item.cpp:12
A model for displaying multiple netlist elements.
Definition: module_model.h:54
Definition: net.h:58
quint32 u32
PinType type