30 #include <QHeaderView>
31 #include <QInputDialog>
33 #include <QPushButton>
34 #include <QStackedWidget>
35 #include <QTableWidget>
36 #include <QVBoxLayout>
39 #include <QListWidget>
47 const QString SelectionDetailsWidget::sAddToGrouping(
"Add to grouping ");
49 SettingsItemCheckbox* SelectionDetailsWidget::sSettingHideEmpty =
50 new SettingsItemCheckbox(
52 "selection_details/hide_empty_sections",
54 "Appearance:Selection Details",
55 "Specifies wheter empty sections are hidden or shown in the Selection Details Widget."
59 :
ContentWidget(
"Selection Details", parent), mNumberSelectedItems(0),
60 mSelectionToGrouping(new
QAction),
86 mSelectionTreeView->
setModel(mSelectionTreeProxyModel);
93 mSelectionTreeView->
hide();
95 mSearchbar =
new Searchbar(treeViewContainer);
99 containerLayout->
addWidget(mSelectionTreeView);
107 mStackedWidget->
addWidget(mGateDetailsTabs);
110 mStackedWidget->
addWidget(mNetDetailsTabs);
113 mStackedWidget->
addWidget(mModuleDetailsTabs);
115 mItemDeletedLabel =
new QLabel(mStackedWidget);
116 mItemDeletedLabel->
setText(
"Currently selected item has been removed. Please consider relayouting the Graph.");
118 mItemDeletedLabel->
setAlignment(Qt::AlignmentFlag::AlignTop);
119 mStackedWidget->
addWidget(mItemDeletedLabel);
121 mNoSelectionLabel =
new QLabel(mStackedWidget);
122 mNoSelectionLabel->
setText(
"No Selection");
124 mNoSelectionLabel->
setAlignment(Qt::AlignmentFlag::AlignCenter);
125 mStackedWidget->
addWidget(mNoSelectionLabel);
139 mSelectionToGrouping->
setToolTip(
"Assign to grouping");
140 mSelectionToModule->
setToolTip(
"Move to module");
146 enableSearchbar(
false);
161 void SelectionDetailsWidget::selectionToGrouping()
165 if (gd.isNewGrouping())
176 Grouping* assignedGrouping =
nullptr;
194 if (
net) assignedGrouping =
net->get_grouping();
200 if (!assignedGrouping)
return nullptr;
220 getModel()->groupingByName(existingGrpName);
221 if (grp) grpId = grp->
get_id();
236 for(
int i = 0; i < mSelectionTreeProxyModel->
rowCount(); i++){
268 void SelectionDetailsWidget::enableSearchbar(
bool enable)
279 void SelectionDetailsWidget::canMoveToModule(
int nodes)
283 : mDisabledIconStyle;
300 mSelectionTreeView->
setModel(mSelectionTreeProxyModel);
311 if (mNumberSelectedItems)
318 enableSearchbar(
true);
322 mSelectionToModule->
setEnabled(toModuleEnabled);
326 : mDisabledIconStyle,
332 singleSelectionInternal(
nullptr);
334 mSelectionTreeView->
populate(
false);
336 enableSearchbar(
false);
349 singleSelectionInternal(&sti);
354 singleSelectionInternal(&sti);
359 singleSelectionInternal(&sti);
367 singleSelectionInternal(sti);
369 if (sti) highlight.
append(sti);
373 void SelectionDetailsWidget::showNoSelection()
376 mModuleDetailsTabs->
clear();
380 void SelectionDetailsWidget::singleSelectionInternal(
const ModuleItem *sti)
387 switch (sti->getType()) {
434 void SelectionDetailsWidget::toggleSearchbar()
451 void SelectionDetailsWidget::updateSearchIcon()
461 toolbar->
addAction(mSelectionToGrouping);
468 return mSelectionTreeView;
473 return mDisabledIconStyle;
478 mDisabledIconStyle =
style;
483 return mSearchIconPath;
488 return mSearchIconStyle;
493 return mSearchActiveIconStyle;
498 mSearchIconPath = path;
503 mSearchIconStyle =
style;
508 mSearchActiveIconStyle =
style;
513 return mToGroupingIconPath;
518 return mToGroupingIconStyle;
523 mToGroupingIconPath = path;
528 mToGroupingIconStyle =
style;
533 return mToModuleIconPath;
538 return mToModuleIconStyle;
543 mToModuleIconPath = path;
548 mToModuleIconStyle =
style;
Adds an item to a module or grouping.
Removes an item from a Module or Grouping.
Set the selection and focus.
GraphTabWidget * getGraphTabWidget()
Get hal's graph tab widget.
GroupingManagerWidget * getGroupingManagerWidget()
Abstract class for Widgets within HAL's ContentArea.
QKeySequence mSearchKeysequence
QShortcut * mSearchShortcut
QVBoxLayout * mContentLayout
Grouping * get_grouping() const
std::string get_name() const
Grouping * get_grouping() const
An item in the ModuleModel.
TreeItemType getType() const
A model for displaying multiple netlist elements.
Gate * get_gate_by_id(const u32 gate_id) const
Module * get_module_by_id(u32 module_id) const
Net * get_net_by_id(u32 net_id) const
Grouping * get_grouping_by_id(u32 grouping_id) const
void addToModuleDialog(const Node &node=Node())
virtual QList< QString > getColumnNames()
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)
int numberSelectedGates() const
QList< UserActionObject > toUserActionObject() const
int numberSelectedItems() const
void selectionChanged(void *sender)
int numberSelectedNets() const
QList< u32 > selectedModulesList() const
QList< u32 > selectedNetsList() const
int numberSelectedModules() const
QList< u32 > selectedGatesList() const
int numberSelectedNodes() const
void registerSender(void *sender, QString name)
Enables filtering of the SelectionTreeModel.
void startSearch(QString text, int options) override
bool isGraphicsBusy() const
Displays the current selection.
void populate(bool mVisible, u32 groupingId=0)
ModuleItem * itemFromIndex(const QModelIndex &index=QModelIndex()) const
void triggerSelection(const ModuleItem *sti)
void addAction(UserAction *act)
void setUseCreatedObject()
The UserAction class is the abstract base class for user interactions.
virtual void setObject(const UserActionObject &obj)
void setObjectLock(bool lock)
The UserActionObject class represents a single object used in UserAction.
UserActionObjectType::ObjectType type() const
QIcon getStyledSvgIcon(const QString &from_to_colors_enabled, const QString &svg_path, QString from_to_colors_disabled=QString())
ContentManager * gContentManager
SelectionRelay * gSelectionRelay
NetlistRelay * gNetlistRelay
QAbstractItemModel * model() const const
void setIcon(const QIcon &icon)
void triggered(bool checked)
void setSpacing(int spacing)
void setAlignment(Qt::Alignment)
void setText(const QString &)
void setWordWrap(bool on)
void setContentsMargins(int left, int top, int right, int bottom)
void append(const T &value)
const T & at(int i) const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * sender() const const
QSet::iterator insert(const T &value)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const const override
virtual int rowCount(const QModelIndex &parent) const const override
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
QString fromStdString(const std::string &str)
bool isEmpty() const const
virtual void setModel(QAbstractItemModel *model) override
void append(const T &value)