18 #include <QApplication>
19 #include <QHeaderView>
20 #include <QItemSelectionModel>
22 #include <QModelIndex>
28 #include <QVBoxLayout>
29 #include <QInputDialog>
38 mToggleNetsAction(new
QAction(this)),
39 mToggleGatesAction(new
QAction(this)),
40 mRenameAction(new
QAction(this)),
41 mDeleteAction(new
QAction(this)),
42 mToggleExpandTreeAction(new
QAction(this)),
56 mToggleNetsAction->
setToolTip(
"Toggle net visibility");
57 mToggleGatesAction->
setToolTip(
"Toggle gate visibility");
61 mToggleExpandTreeAction->
setToolTip(
"Toggle expand all / collapse all");
66 mTreeView->
setModel(mModuleProxyModel);
83 enableDeleteAction(
false);
84 mIgnoreSelectionChange =
false;
119 void ModuleWidget::enableDeleteAction(
bool enable)
125 void ModuleWidget::handleToggleNetsClicked()
137 void ModuleWidget::handleToggleGatesClicked()
149 void ModuleWidget::handleToggleExpandTreeClicked()
163 void ModuleWidget::handleRenameClicked()
165 ModuleItem* item = getModuleItemFromIndex(mTreeView->
currentIndex());
176 toolbar->
addAction(mToggleExpandTreeAction);
214 QString output =
"navigation regular expression '" + text +
"' entered.";
225 ModuleItem* item = getModuleItemFromIndex(index);
254 mIgnoreSelectionChange =
true;
260 ModuleItem* mi = getModuleItemFromIndex(current);
262 enableDeleteAction(
false);
272 if (mIgnoreSelectionChange || mModuleModel->
isModifying())
281 for (
const auto& index : current_selection)
283 ModuleItem* mi = getModuleItemFromIndex(index);
299 if (selectedMods.
size() == 1)
302 enableDeleteAction(
true);
304 else if (selectedGats.
size() == 1)
307 enableDeleteAction(
false);
311 enableDeleteAction(
false);
319 ModuleItem* mi = getModuleItemFromIndex(index);
332 mIgnoreSelectionChange =
true;
343 module_selection.
select(index, index);
348 mTreeView->
selectionModel()->
select(module_selection, QItemSelectionModel::SelectionFlag::ClearAndSelect);
350 mIgnoreSelectionChange =
false;
373 return mDisabledIconStyle;
378 return mActiveIconStyle;
383 return mModuleProxyModel;
388 return mShowNetsIconPath;
393 return mHideNetsIconPath;
398 return mShowGatesIconPath;
403 return mHideGatesIconPath;
408 return mSearchIconPath;
413 return mSearchIconStyle;
418 return mSearchActiveIconStyle;
423 return mDeleteIconPath;
428 return mRenameIconPath;
433 return mExpandedIconPath;
438 return mCollapsedIconPath;
443 mDisabledIconStyle =
style;
448 mActiveIconStyle =
style;
453 mShowNetsIconPath = path;
458 mHideNetsIconPath = path;
463 mShowGatesIconPath = path;
468 mHideGatesIconPath = path;
473 mSearchIconPath = path;
478 mSearchIconStyle =
style;
483 mSearchActiveIconStyle =
style;
488 mDeleteIconPath = path;
493 mRenameIconPath = path;
498 mExpandedIconPath = path;
503 mCollapsedIconPath = path;
506 void ModuleWidget::deleteSelectedItem()
513 ModuleItem* selectedItem = getModuleItemFromIndex(mTreeView->
currentIndex());
514 if(selectedItem->getParent() !=
nullptr)
525 void ModuleWidget::handleDeleteShortcutOnFocusChanged(
QWidget* oldWidget,
QWidget* newWidget)
528 if(!newWidget)
return;
529 if(newWidget->
parent() ==
this)
QModelIndex getIndexFromItem(BaseTreeItem *item) const
QStringList headerLabels() const
static SettingsItemKeybind * sSettingDeleteItem
Abstract class for Widgets within HAL's ContentArea.
QKeySequence mSearchKeysequence
QShortcut * mSearchShortcut
QVBoxLayout * mContentLayout
void openGateInView(u32 gateId)
void openModuleInView(u32 moduleId, bool unfold)
void openNetEndpointsInView(u32 netId)
static void addPluginSubmenus(QMenu *contextMenu, Netlist *netlist, const std::vector< u32 > &modules, const std::vector< u32 > &gates, const std::vector< u32 > &nets)
bool is_top_module() const
An item in the ModuleModel.
TreeItemType getType() const
A model for displaying multiple netlist elements.
QList< ModuleItem * > getItems(const u32 id, ModuleItem::TreeItemType type=ModuleItem::TreeItemType::Module) const
ModuleItem * getItem(const QModelIndex &index) const
void populateTree(const QVector< u32 > &modIds={}, const QVector< u32 > &gatIds={}, const QVector< u32 > &netIds={})
Enables filtering in the ModuleModel.
void startSearch(QString text, int options) override
Wraps the QTreeView used for the ModuleWidget.
void collapseAllModules()
bool toggleStateExpanded() const
void setDefaultColumnWidth()
Module * get_top_module() const
Module * get_module_by_id(u32 module_id) const
void deleteModule(const u32 id)
void changeElementNameDialog(ModuleItem::TreeItemType type, u32 id)
void moduleSubmoduleRemoved(Module *m, const u32 removed_module) const
A QFrame with a QLineEdit that can be used to input a substring to search for.
void setColumnNames(QList< QString > list)
void triggerNewSearch(const QString &text, int searchOptions)
void setFocus(ItemType ftype, u32 fid, Subfocus sfoc=Subfocus::None, u32 sfinx=0)
void selectionChanged(void *sender)
void relaySelectionChanged(void *sender)
QList< u32 > selectedModulesList() const
void registerSender(void *sender, QString name)
void keySequenceChanged(QKeySequence value)
#define log_info(channel,...)
const Module * module(const Gate *g, const NodeBoxes &boxes)
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
GraphContextManager * gGraphContextManager
SelectionRelay * gSelectionRelay
NetlistRelay * gNetlistRelay
QModelIndex currentIndex() const const
void doubleClicked(const QModelIndex &index)
void setEditTriggers(QAbstractItemView::EditTriggers triggers)
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
void setSelectionMode(QAbstractItemView::SelectionMode mode)
QItemSelectionModel * selectionModel() const const
void setIcon(const QIcon &icon)
void triggered(bool checked)
void focusChanged(QWidget *old, QWidget *now)
void setFrameStyle(int style)
void select(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void append(const T &value)
bool isValid() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const const
QObject * sender() const const
bool isValid() const const
QSet::iterator insert(const T &value)
void setEnabled(bool enable)
void setKey(const QKeySequence &key)
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const const override
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
void setFilterRegularExpression(const QString &pattern)
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
void sortByColumn(int column)
void setExpandsOnDoubleClick(bool enable)
virtual QModelIndex indexAt(const QPoint &point) const const override
virtual void setModel(QAbstractItemModel *model) override
void setSortingEnabled(bool enable)