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:
parent
175132539b
commit
1869dd0de3
@ -32,7 +32,8 @@ FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent)
|
|||||||
}
|
}
|
||||||
ui->sortByBox->setCurrentText(filterModel->translateCurrentSorting());
|
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->sortByBox, &QComboBox::currentTextChanged, this, &FtbPage::onSortingSelectionChanged);
|
||||||
connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FtbPage::onSelectionChanged);
|
connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FtbPage::onSelectionChanged);
|
||||||
connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FtbPage::onVersionSelectionChanged);
|
connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FtbPage::onVersionSelectionChanged);
|
||||||
@ -104,6 +105,11 @@ void FtbPage::triggerSearch()
|
|||||||
filterModel->setSearchTerm(ui->searchEdit->text());
|
filterModel->setSearchTerm(ui->searchEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FtbPage::resetSearch()
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText("");
|
||||||
|
}
|
||||||
|
|
||||||
void FtbPage::onSortingSelectionChanged(QString data)
|
void FtbPage::onSortingSelectionChanged(QString data)
|
||||||
{
|
{
|
||||||
auto toSet = filterModel->getAvailableSortings().value(data);
|
auto toSet = filterModel->getAvailableSortings().value(data);
|
||||||
|
@ -65,6 +65,8 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void triggerSearch();
|
void triggerSearch();
|
||||||
|
void resetSearch();
|
||||||
|
|
||||||
void onSortingSelectionChanged(QString data);
|
void onSortingSelectionChanged(QString data);
|
||||||
void onSelectionChanged(QModelIndex first, QModelIndex second);
|
void onSelectionChanged(QModelIndex first, QModelIndex second);
|
||||||
void onVersionSelectionChanged(QString data);
|
void onVersionSelectionChanged(QString data);
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QPushButton" name="searchButton">
|
<widget class="QPushButton" name="resetButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Search</string>
|
<string>Reset</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -49,15 +49,15 @@
|
|||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeView" name="packView">
|
<widget class="QTreeView" name="packView">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>48</width>
|
<width>48</width>
|
||||||
<height>48</height>
|
<height>48</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@ -76,7 +76,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>searchEdit</tabstop>
|
<tabstop>searchEdit</tabstop>
|
||||||
<tabstop>searchButton</tabstop>
|
<tabstop>resetButton</tabstop>
|
||||||
<tabstop>versionSelectionBox</tabstop>
|
<tabstop>versionSelectionBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user