Skip to content

Commit

Permalink
Merge branch 'master' of github.com:emsec/hal
Browse files Browse the repository at this point in the history
  • Loading branch information
swallat committed Oct 29, 2020
2 parents 258be80 + 928c15a commit d91913b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/gui/src/grouping/grouping_manager_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace hal

void GroupingManagerWidget::handleColorSelectClicked()
{
QModelIndex currentIndex = mGroupingTableView->currentIndex();
QModelIndex currentIndex = m_proxy_model->mapToSource(mGroupingTableView->currentIndex());
if (!currentIndex.isValid()) return;
QModelIndex nameIndex = mGroupingTableModel->index(currentIndex.row(),0);
QString name = mGroupingTableModel->data(nameIndex,Qt::DisplayRole).toString();
Expand All @@ -132,7 +132,7 @@ namespace hal

void GroupingManagerWidget::handleToSelectionClicked()
{
QModelIndex currentIndex = mGroupingTableView->currentIndex();
QModelIndex currentIndex = m_proxy_model->mapToSource(mGroupingTableView->currentIndex());
if (!currentIndex.isValid()) return;
Grouping* grp = getCurrentGrouping().grouping();
if (!grp) return;
Expand All @@ -147,7 +147,7 @@ namespace hal

void GroupingManagerWidget::handleRenameGroupingClicked()
{
QModelIndex currentIndex = mGroupingTableView->currentIndex();
QModelIndex currentIndex = m_proxy_model->mapToSource(mGroupingTableView->currentIndex());
if (!currentIndex.isValid()) return;
QModelIndex modelIndex = mGroupingTableModel->index(currentIndex.row(),0);

Expand All @@ -166,7 +166,7 @@ namespace hal

void GroupingManagerWidget::handleDeleteGroupingClicked()
{
mGroupingTableModel->removeRows(mGroupingTableView->currentIndex().row());
mGroupingTableModel->removeRows(m_proxy_model->mapToSource(mGroupingTableView->currentIndex()).row());
}

void GroupingManagerWidget::handle_selection_changed(const QItemSelection &selected, const QItemSelection &deselected)
Expand Down Expand Up @@ -200,7 +200,7 @@ namespace hal

GroupingTableEntry GroupingManagerWidget::getCurrentGrouping()
{
QModelIndex modelIndex = mGroupingTableView->currentIndex();
QModelIndex modelIndex = m_proxy_model->mapToSource(mGroupingTableView->currentIndex());

return mGroupingTableModel->groupingAt(modelIndex.row());
}
Expand Down
15 changes: 15 additions & 0 deletions plugins/gui/src/grouping/grouping_table_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ namespace hal {
GroupingTableModel::GroupingTableModel(QObject* parent)
: QAbstractTableModel(parent), mDisableEvents(false)
{
//on creation load all already existing groupings from the netlist into the model
for(auto grp : g_netlist->get_groupings())
{
mDisableEvents = true;
Q_EMIT layoutAboutToBeChanged();
GroupingTableEntry gte(grp->get_id(), nextColor());
int n = mGroupings.size();
mGroupings.append(gte);
Q_EMIT layoutChanged();
mDisableEvents = false;

QModelIndex inx = index(n,0);
Q_EMIT newEntryAdded(inx);
}

connect(g_netlist_relay, &NetlistRelay::grouping_created, this, &GroupingTableModel::createGroupingEvent);
connect(g_netlist_relay, &NetlistRelay::grouping_removed, this, &GroupingTableModel::deleteGroupingEvent);
connect(g_netlist_relay, &NetlistRelay::grouping_nameChanged, this, &GroupingTableModel::groupingNameChangedEvent);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wiki_images/graph_view/graph_view_overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wiki_images/selection/multi_selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wiki_images/selection/single_selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d91913b

Please sign in to comment.