Skip to content

Commit

Permalink
added search in grouping_dialog.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
neoneela committed Oct 12, 2023
1 parent 477f500 commit 8a39682
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugins/gui/include/gui/grouping_dialog/grouping_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ namespace hal {
GroupingTableView* mGroupingTableView;
GroupingTableView* mLastUsed;

GroupingProxyModel* mProxyModel;

QDialogButtonBox* mButtonBox;
QTabWidget* mTabWidget;

Expand Down
8 changes: 8 additions & 0 deletions plugins/gui/src/grouping_dialog/grouping_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace hal {
GroupingDialog::GroupingDialog(QWidget* parent)
: QDialog(parent),
mSearchbar(new Searchbar(this)),
mProxyModel(new GroupingProxyModel),
mGroupingTableView(new GroupingTableView(false, this)),
mLastUsed(nullptr),
mTabWidget(new QTabWidget(this)),
Expand All @@ -34,7 +35,13 @@ namespace hal {
connect(butSearch, &QPushButton::pressed, this, &GroupingDialog::handleToggleSearchbar);
layout->addWidget(butSearch, 0, 1);

mProxyModel->setSourceModel(mGroupingTableView->model());
mProxyModel->setSortRole(Qt::UserRole);
mGroupingTableView->setModel(mProxyModel);

mSearchbar->hide();
mSearchbar->setColumnNames(mProxyModel->getColumnNames());

layout->addWidget(mSearchbar, 1, 0, 1, 3);

mTabWidget->addTab(mGroupingTableView, "Groupings");
Expand Down Expand Up @@ -74,6 +81,7 @@ namespace hal {
connect(mButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(mButtonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(mGroupingTableView, &GroupingTableView::groupingSelected, this, &GroupingDialog::handleGroupingSelected);
connect(mSearchbar, &Searchbar::triggerNewSearch, mProxyModel, &GroupingProxyModel::startSearch);
}

void GroupingDialog::handleNewGroupingClicked()
Expand Down
11 changes: 9 additions & 2 deletions plugins/gui/src/searchbar/searchcolumndialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ namespace hal {
cbox->setChecked(true);
mDisableHandler = false;
}
if (sender()==mCheckAllColumns && state == Qt::Unchecked)
{
mDisableHandler = true;
for (QCheckBox* cbox : mCheckColumn)
cbox->setChecked(false);
mDisableHandler = false;
}
bool allChecked = true;
bool nullChecked = true;

Expand All @@ -58,8 +65,8 @@ namespace hal {
allChecked = false;
}

if (mCheckAllColumns->isChecked() != allChecked)
mCheckAllColumns->setChecked(allChecked);
/*if (mCheckAllColumns->isChecked() != allChecked)
mCheckAllColumns->setChecked(allChecked);*/

mButtonBox->button(QDialogButtonBox::Ok)->setDisabled(nullChecked);
}
Expand Down

0 comments on commit 8a39682

Please sign in to comment.