Slight cleanup

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-11-01 18:30:11 +00:00
parent c890aa18f7
commit d1626d20bd

View File

@ -287,12 +287,15 @@ void ModPage::openUrl(const QUrl& url)
newPage->ui->searchEdit->setText(slug); newPage->ui->searchEdit->setText(slug);
newPage->triggerSearch(); newPage->triggerSearch();
connect(newPage->listModel->activeJob(), &Task::finished, [slug, newPage] { ModPlatform::ListModel* model = newPage->listModel;
for (int row = 0; row < newPage->listModel->rowCount({}); row++) { QListView* view = newPage->ui->packView;
QModelIndex index = newPage->listModel->index(row);
auto pack = newPage->listModel->data(index, Qt::UserRole).value<ModPlatform::IndexedPack>(); connect(model->activeJob(), &Task::finished, [slug, model, view] {
for (int row = 0; row < model->rowCount({}); row++) {
QModelIndex index = model->index(row);
ModPlatform::IndexedPack pack = model->data(index, Qt::UserRole).value<ModPlatform::IndexedPack>();
if (pack.slug == slug) { if (pack.slug == slug) {
newPage->ui->packView->setCurrentIndex(index); view->setCurrentIndex(index);
break; break;
} }
} }