diff --git a/plugins/gui/include/gui/module_model/module_item.h b/plugins/gui/include/gui/module_model/module_item.h index 579f6cc0579..f61ce42b727 100644 --- a/plugins/gui/include/gui/module_model/module_item.h +++ b/plugins/gui/include/gui/module_model/module_item.h @@ -160,13 +160,6 @@ namespace hal */ u32 id() const; - /** - * Gets the color of the netlist item this ModuleItem represents. - * - * @returns the module color - */ - QColor color() const; - /** * Checks if this ModuleItem is currently highlighted. * @@ -195,13 +188,6 @@ namespace hal */ void setName(const QString& name); - /** - * Sets the color of the module this ModuleItem represents. - * - * @param color - The new color - */ - void setColor(const QColor& color); - /** * Marks/Unmarks this ModuleItem as highlighted. * @@ -218,7 +204,6 @@ namespace hal TreeItemType mType; QString mName; - QColor mColor; bool mHighlighted; }; } diff --git a/plugins/gui/src/grouping/grouping_color_serializer.cpp b/plugins/gui/src/grouping/grouping_color_serializer.cpp index 097cf87d98c..fc6169d4f78 100644 --- a/plugins/gui/src/grouping/grouping_color_serializer.cpp +++ b/plugins/gui/src/grouping/grouping_color_serializer.cpp @@ -126,9 +126,11 @@ namespace hal { QModelIndex inx = mm->index(irow,0,parent); const ModuleItem* mItem = mm->getItem(inx); if (!mItem) continue; + if(mItem->getType() != ModuleItem::TreeItemType::Module) continue; + QJsonObject mcEntry; mcEntry["id"] = (int) mItem->id(); - mcEntry["color"] = mItem->color().name(QColor::HexArgb); + mcEntry["color"] = mm->moduleColor(mItem->id()).name(QColor::HexArgb); mcArr.append(mcEntry); serializeColorRecursion(mcArr,mm,inx); } diff --git a/plugins/gui/src/module_model/module_item.cpp b/plugins/gui/src/module_model/module_item.cpp index a5aec2f5815..ac4119dec11 100644 --- a/plugins/gui/src/module_model/module_item.cpp +++ b/plugins/gui/src/module_model/module_item.cpp @@ -17,7 +17,6 @@ namespace hal { case TreeItemType::Module: mName = QString::fromStdString(gNetlist->get_module_by_id(id)->get_name()); - mColor = gNetlistRelay->getModuleColor(id); break; case TreeItemType::Gate: mName = QString::fromStdString(gNetlist->get_gate_by_id(id)->get_name()); @@ -139,11 +138,6 @@ namespace hal return mId; } - QColor ModuleItem::color() const - { - return mColor; - } - bool ModuleItem::highlighted() const { return mHighlighted; @@ -163,11 +157,6 @@ namespace hal mName = name; } - void ModuleItem::setColor(const QColor& color) - { - mColor = color; - } - void ModuleItem::setHighlighted(const bool highlighted) { mHighlighted = highlighted; diff --git a/plugins/gui/src/module_model/module_model.cpp b/plugins/gui/src/module_model/module_model.cpp index 39027fa6ae1..165600749cd 100644 --- a/plugins/gui/src/module_model/module_model.cpp +++ b/plugins/gui/src/module_model/module_model.cpp @@ -4,7 +4,7 @@ #include "gui/gui_globals.h" #include "gui/gui_utils/graphics.h" -//#include "gui/ModuleModel/ModuleItem.h" + #include "gui/selection_details_widget/selection_details_icon_provider.h" #include "hal_core/netlist/gate.h" @@ -121,7 +121,7 @@ namespace hal { switch(item->getType()){ case ModuleItem::TreeItemType::Module: - return QIcon(*SelectionDetailsIconProvider::instance()->getIcon(SelectionDetailsIconProvider::ModuleIcon, item->id())); + return QIcon(gui_utility::getStyledSvgIcon("all->" + mModuleColors[item->id()].name(QColor::HexRgb), ":/icons/ne_module")); case ModuleItem::TreeItemType::Gate: return QIcon(*SelectionDetailsIconProvider::instance()->getIcon(SelectionDetailsIconProvider::GateIcon, item->id())); case ModuleItem::TreeItemType::Net: @@ -444,7 +444,6 @@ namespace hal assert(item); item->setName(QString::fromStdString(gNetlist->get_module_by_id(id)->get_name())); // REMOVE & ADD AGAIN - item->setColor(gNetlistRelay->getModuleColor(id)); QModelIndex index = getIndex(item); Q_EMIT dataChanged(index, index);