NOISSUE Search as you type for modpacks.ch

Since we just filter data locally now, this isn't painfully slow -
indeed it's very quick. This also matches other platforms, such as
ATLauncher.
This commit is contained in:
Jamie Mansfield
2021-10-16 23:36:31 +01:00
parent 175132539b
commit 1869dd0de3
3 changed files with 15 additions and 7 deletions

View File

@ -32,7 +32,8 @@ FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent)
}
ui->sortByBox->setCurrentText(filterModel->translateCurrentSorting());
connect(ui->searchButton, &QPushButton::clicked, this, &FtbPage::triggerSearch);
connect(ui->searchEdit, &QLineEdit::textChanged, this, &FtbPage::triggerSearch);
connect(ui->resetButton, &QPushButton::clicked, this, &FtbPage::resetSearch);
connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &FtbPage::onSortingSelectionChanged);
connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FtbPage::onSelectionChanged);
connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FtbPage::onVersionSelectionChanged);
@ -104,6 +105,11 @@ void FtbPage::triggerSearch()
filterModel->setSearchTerm(ui->searchEdit->text());
}
void FtbPage::resetSearch()
{
ui->searchEdit->setText("");
}
void FtbPage::onSortingSelectionChanged(QString data)
{
auto toSet = filterModel->getAvailableSortings().value(data);