|
HAL
|
An item in the ModuleModel. More...
#include <module_item.h>


Public Types | |
| enum class | TreeItemType { Module , Gate , Net } |
Public Member Functions | |
| void | setData (QList< QVariant > data) override |
| void | setDataAtColumn (int column, QVariant &data) override |
| void | appendData (QVariant data) override |
| int | getColumnCount () const override |
| ModuleItem (const u32 id, const TreeItemType type, ModuleModel *model) | |
| virtual | ~ModuleItem () |
| void | appendExistingChildIfAny (const QMap< u32, ModuleItem * > &moduleMap) |
| QVariant | getData (int column) const override |
| QString | name () const |
| u32 | id () const |
| bool | highlighted () const |
| bool | isToplevelItem () const |
| TreeItemType | getType () const |
| void | setName (const QString &name) |
| void | setModuleType (const QString &moduleType) |
| void | setHighlighted (const bool highlighted) |
Public Member Functions inherited from hal::BaseTreeItem | |
| BaseTreeItem () | |
| BaseTreeItem (QList< QVariant > columnData) | |
| virtual | ~BaseTreeItem () |
| virtual BaseTreeItem * | getParent () const |
| virtual void | setParent (BaseTreeItem *parent) |
| virtual BaseTreeItem * | getChild (int row) const |
| virtual QList< BaseTreeItem * > | getChildren () const |
| virtual void | appendChild (BaseTreeItem *child) |
| virtual void | insertChild (int index, BaseTreeItem *child) |
| virtual BaseTreeItem * | removeChildAtPos (int row) |
| virtual bool | removeChild (BaseTreeItem *child) |
| virtual int | getChildCount () const |
| virtual int | getRowForChild (const BaseTreeItem *child) const |
| virtual int | getOwnRow () |
Additional Inherited Members | |
Protected Attributes inherited from hal::BaseTreeItem | |
| BaseTreeItem * | mParent |
| QList< BaseTreeItem * > | mChildren |
An item in the ModuleModel.
The ModuleItem is one item in the ModuleModel item model. It represents either a module, a gate or a net of the netlist.
Definition at line 47 of file module_item.h.
|
strong |
The possible types that a ModuleItem in the ModuleModel can have.
| Enumerator | |
|---|---|
| Module | |
| Gate | |
| Net | |
Definition at line 53 of file module_item.h.
| hal::ModuleItem::ModuleItem | ( | const u32 | id, |
| const TreeItemType | type, | ||
| ModuleModel * | model | ||
| ) |
Constructor.
| id | - The id of the netlist item this ModuleItem represents |
| type | - The type of the netlist item |
| model | - The parent model where this item is added to. |
Definition at line 12 of file module_item.cpp.
References QString::fromStdString(), test_plugin::g, Gate, hal::Netlist::get_gate_by_id(), hal::Netlist::get_module_by_id(), hal::Module::get_name(), hal::Netlist::get_net_by_id(), hal::Module::get_type(), hal::gNetlist, Module, test::n, Net, and type.
|
virtual |
Destructor.
Must remove item from ModuleModel map as well.
Definition at line 48 of file module_item.cpp.
|
overridevirtual |
Unused dummy function overwritten from parent class.
Implements hal::BaseTreeItem.
Definition at line 163 of file module_item.cpp.
References hal::data.
| void hal::ModuleItem::appendExistingChildIfAny | ( | const QMap< u32, ModuleItem * > & | moduleMap | ) |
Given a set of ModuleItems (in a map [id]->[ModuleItem]) this function adds each ModuleItem of this set as a new children if its underlying module is a submodule (child) of the underlying module of this ModuleItem.
| moduleMap | - A map [id]->[ModuleItem] of children candidates |
Definition at line 60 of file module_item.cpp.
References hal::BaseTreeItem::appendChild(), QMap::constEnd(), QMap::find(), hal::Netlist::get_module_by_id(), hal::Module::get_submodules(), hal::gNetlist, Module, and hal::BaseTreeItem::setParent().
|
overridevirtual |
Get the number of currently stored column data.
Implements hal::BaseTreeItem.
Definition at line 158 of file module_item.cpp.
|
overridevirtual |
Gets the data of this item model item i.e. the name of this ModuleItem if column=1.
| column | - The column to get the data for |
Implements hal::BaseTreeItem.
Definition at line 88 of file module_item.cpp.
Referenced by hal::ModuleModel::data().
| ModuleItem::TreeItemType hal::ModuleItem::getType | ( | ) | const |
Gets the type of the netlist item this ModuleItem represents.
Definition at line 144 of file module_item.cpp.
Referenced by hal::ModuleModel::data(), hal::ModuleElementsTree::handleContextMenuRequested(), hal::ModuleWidget::handleCurrentChanged(), hal::ModuleWidget::handleItemDoubleClicked(), hal::ModuleWidget::handleTreeSelectionChanged(), hal::ModuleWidget::handleTreeViewContextMenuRequested(), hal::ModuleProxyModel::lessThan(), hal::ModuleModel::mimeData(), and hal::SelectionDetailsWidget::selectionToGroupingAction().
| bool hal::ModuleItem::highlighted | ( | ) | const |
Checks if this ModuleItem is currently highlighted.
Definition at line 133 of file module_item.cpp.
Referenced by hal::ModuleModel::data(), and setHighlighted().
| u32 hal::ModuleItem::id | ( | ) | const |
Gets the id of the netlist item this ModuleItem represents.
Definition at line 128 of file module_item.cpp.
Referenced by hal::ModuleModel::data(), hal::ModuleElementsTree::handleContextMenuRequested(), hal::ModuleWidget::handleItemDoubleClicked(), hal::ModuleWidget::handleTreeSelectionChanged(), hal::ModuleWidget::handleTreeViewContextMenuRequested(), hal::ModuleModel::mimeData(), hal::ModuleModel::moduleAssignGate(), hal::SelectionDetailsWidget::selectionToGroupingAction(), hal::ModuleModel::updateModuleParent(), and hal::ModuleModel::updateNetParent().
| bool hal::ModuleItem::isToplevelItem | ( | ) | const |
Checks if this ModuleItem is direct child to mRootItem
Definition at line 138 of file module_item.cpp.
References hal::BaseTreeItem::mParent.
Referenced by hal::ModuleModel::moduleAssignGate(), and hal::ModuleModel::updateModuleParent().
| QString hal::ModuleItem::name | ( | ) | const |
Gets the name of the netlist item this ModuleItem represents.
Definition at line 123 of file module_item.cpp.
Referenced by setName().
Sets the data for the columns name and type. Column 2 (type) can be only set, if this item is a module.
| data | - Each entry in the list represents one column. The second column (id) is ignored. |
Implements hal::BaseTreeItem.
Definition at line 102 of file module_item.cpp.
References hal::data, Module, setModuleType(), and setName().
|
overridevirtual |
Sets the data for a specified column. Column 2 (type) can only be set, if this item is a module.
| index | - The column to set the new data. Either 0 (name) or 2(type). Other columns will be ignored. |
| data | - The new column data. |
Implements hal::BaseTreeItem.
Definition at line 109 of file module_item.cpp.
References hal::data, setModuleType(), and setName().
| void hal::ModuleItem::setHighlighted | ( | const bool | highlighted | ) |
Marks/Unmarks this ModuleItem as highlighted.
| highlighted | - true if the ModuleItem should be marked as highlighted. false if the ModuleItem should be marked as NOT highlighted. |
Definition at line 153 of file module_item.cpp.
References highlighted().
| void hal::ModuleItem::setModuleType | ( | const QString & | moduleType | ) |
Set the module type name (gate types are immutable)
| moduleType |
Definition at line 79 of file module_item.cpp.
References hal::Netlist::get_module_by_id(), hal::gNetlist, Module, hal::ShortestPath::module(), hal::Module::set_type(), and QString::toStdString().
Referenced by setData(), setDataAtColumn(), and hal::ModuleModel::updateModuleType().
| void hal::ModuleItem::setName | ( | const QString & | name | ) |
Sets the name of this ModuleItem (not the underlying module).
| name | - The new name |
Definition at line 148 of file module_item.cpp.
References name().
Referenced by setData(), setDataAtColumn(), hal::ModuleModel::updateGateName(), hal::ModuleModel::updateModuleName(), and hal::ModuleModel::updateNetName().