Skip to content

Commit

Permalink
Bugfix: avoid double booking of proxy model
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Oct 31, 2023
1 parent db4fa7f commit c1d416a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions plugins/gui/include/gui/module_dialog/gate_select_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,9 @@ namespace hal {
/**
* @brief GateSelectView constructor
* @param history if true a list of modules previously selected gets generated
* @param sbar the filter-string editor to connect with
* @param parent the parent widget
*/
GateSelectView(bool history, Searchbar* sbar, const QSet<u32>& selectable,
QWidget* parent=nullptr);
GateSelectView(bool history, const QSet<u32>& selectable, QWidget* parent=nullptr);

Q_SIGNALS:
void gateSelected(u32 gatId, bool doubleClick);
Expand Down
9 changes: 3 additions & 6 deletions plugins/gui/src/module_dialog/gate_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ namespace hal {
// mTreeView = new QTreeView(mTabWidget);
// mTabWidget->addTab(mTreeView, "Gate tree");

mTableView = new GateSelectView(false,mSearchbar,selectable,mTabWidget);
mTableView = new GateSelectView(false,selectable,mTabWidget);
mGateTableProxyModel = static_cast<GateSelectProxy*>(mTableView->model());
connect(mTableView,&GateSelectView::gateSelected,this,&GateDialog::handleTableSelection);
mTabWidget->addTab(mTableView, "Gate list");

mGateTableProxyModel = new GateSelectProxy(this),
mGateTableProxyModel->setSourceModel(mTableView->model());
mTableView->setModel(mGateTableProxyModel);

if (!GateSelectHistory::instance()->isEmpty())
{
mLastUsed = new GateSelectView(true,mSearchbar,selectable,mTabWidget);
mLastUsed = new GateSelectView(true,selectable,mTabWidget);
if (mLastUsed->model()->rowCount())
{
connect(mLastUsed,&GateSelectView::gateSelected,this,&GateDialog::handleTableSelection);
Expand Down
3 changes: 1 addition & 2 deletions plugins/gui/src/module_dialog/gate_select_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,12 @@ namespace hal
}

//---------------- VIEW -------------------------------------------
GateSelectView::GateSelectView(bool history, Searchbar* sbar, const QSet<u32> &selectable, QWidget* parent) : QTableView(parent)
GateSelectView::GateSelectView(bool history, const QSet<u32> &selectable, QWidget* parent) : QTableView(parent)
{
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::SingleSelection);

GateSelectProxy* prox = new GateSelectProxy(this);
connect(sbar, &Searchbar::textEdited, prox, &GateSelectProxy::searchTextChanged);

GateSelectModel* modl = new GateSelectModel(history, selectable, this);
prox->setSourceModel(modl);
Expand Down

0 comments on commit c1d416a

Please sign in to comment.