Skip to content

Commit

Permalink
Bugfix : proxy model was pointing to proxy instead of source model
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Aug 6, 2024
1 parent a19a602 commit ac2454c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions plugins/gui/include/gui/module_dialog/module_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ namespace hal {
QTabWidget* mTabWidget;

ModuleProxyModel* mModuleTreeProxyModel;
ModuleSelectProxy* mModuleTableProxyModel;
ModuleSelectModel* mModuleSelectModel;

Searchbar* mSearchbar;
QAction* mToggleSearchbar;
ModuleSelectExclude mSelectExclude;
Expand Down
11 changes: 3 additions & 8 deletions plugins/gui/src/module_dialog/module_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ namespace hal {
mTreeView->setModel(mModuleTreeProxyModel);
mTreeView->expandAll();

mModuleTableProxyModel = new ModuleSelectProxy(this),
mModuleTableProxyModel->setSourceModel(mTableView->model());
mTableView->setModel(mModuleTableProxyModel);


mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
layout->addWidget(mButtonBox, 3, 0, 1, 3, Qt::AlignHCenter);

Expand All @@ -116,7 +111,7 @@ namespace hal {
if(mTabWidget->currentWidget() == mTreeView)
mSearchbar->setColumnNames(mModuleTreeProxyModel->getColumnNames());
else
mSearchbar->setColumnNames(mModuleTableProxyModel->getColumnNames());
mSearchbar->setColumnNames(static_cast<ModuleSelectProxy*>(mTableView->model())->getColumnNames());

connect(mTabWidget, &QTabWidget::currentChanged, this, &ModuleDialog::handleCurrentTabChanged);
connect(mToggleSearchbar, &QAction::triggered, this, &ModuleDialog::handleToggleSearchbar);
Expand All @@ -128,7 +123,7 @@ namespace hal {
connect(mTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ModuleDialog::handleTreeSelectionChanged);

connect(mSearchbar, &Searchbar::triggerNewSearch, mModuleTreeProxyModel, &ModuleProxyModel::startSearch);
connect(mSearchbar, &Searchbar::triggerNewSearch, mModuleTableProxyModel, &ModuleSelectProxy::startSearch);
connect(mSearchbar, &Searchbar::triggerNewSearch, static_cast<ModuleSelectProxy*>(mTableView->model()), &ModuleSelectProxy::startSearch);
}

void ModuleDialog::enableButtons()
Expand Down Expand Up @@ -247,7 +242,7 @@ namespace hal {
if(mTabWidget->currentWidget() == mTreeView)
mSearchbar->setColumnNames(mModuleTreeProxyModel->getColumnNames());
else
mSearchbar->setColumnNames(mModuleTableProxyModel->getColumnNames());
mSearchbar->setColumnNames(static_cast<ModuleSelectProxy*>(mTableView->model())->getColumnNames());
mTreeView->clearSelection();
mTableView->clearSelection();
mSearchbar->clear();
Expand Down

0 comments on commit ac2454c

Please sign in to comment.