Skip to content

Commit

Permalink
change ModuleItem to inherit from BaseTreeItem and ModuleModel to inh…
Browse files Browse the repository at this point in the history
…erit from BaseTreeModel
  • Loading branch information
Julia authored and Julia committed Oct 21, 2023
1 parent 71e00b1 commit 7a8d034
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 27 deletions.
68 changes: 49 additions & 19 deletions plugins/gui/src/module_model/module_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@

namespace hal
{
void ModuleItem::setData(QList<QVariant> data)
{

}

void ModuleItem::setDataAtIndex(int index, QVariant &data)
{

}

void ModuleItem::appendData(QVariant data)
{

}

int ModuleItem::getColumnCount() const
{

}

ModuleItem::ModuleItem(const u32 id, const TreeItemType type) :
mParent(nullptr),
Expand Down Expand Up @@ -148,6 +129,48 @@ ModuleItem::ModuleItem(const u32 id, const TreeItemType type) :
return QVariant();
}

void ModuleItem::setData(QList<QVariant> data)
{
setName(data[0].toString());
switch(mType)
{
case TreeItemType::Module:
{
Module* module = gNetlist->get_module_by_id(mId);
if(!module)
return;
module->set_type(data[3].toString().toStdString());
}
case TreeItemType::Gate:
return;
}
}

void ModuleItem::setDataAtIndex(int index, QVariant &data)
{
if(index == 0) {
setName(data.toString());
return;
}
else if (index == 1)
return;
else if(index == 2)
{
switch(mType)
{
case TreeItemType::Module:
{
Module* module = gNetlist->get_module_by_id(mId);
if(!module)
return;
module->set_type(data.toString().toStdString());
}
case TreeItemType::Gate:
return;
}
}
}

QString ModuleItem::name() const
{
return mName;
Expand Down Expand Up @@ -181,4 +204,11 @@ ModuleItem::ModuleItem(const u32 id, const TreeItemType type) :
{
mHighlighted = highlighted;
}

int ModuleItem::getColumnCount() const
{
return 3;
}

void ModuleItem::appendData(QVariant data) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ namespace hal

}

void PinTreeItem::appendData(QVariant data)
{

}
void PinTreeItem::appendData(QVariant data) {}

int PinTreeItem::getColumnCount() const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ namespace hal
}
}

void NetlistElementsTreeitem::appendData(QVariant data)
{

}
void NetlistElementsTreeitem::appendData(QVariant data) {}

int NetlistElementsTreeitem::getColumnCount() const
{
Expand Down

0 comments on commit 7a8d034

Please sign in to comment.