From d1626d20bd4fdeeb1e9cf0f00d862fc75ddaa663 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 1 Nov 2022 18:30:11 +0000 Subject: [PATCH] Slight cleanup Signed-off-by: TheKodeToad --- launcher/ui/pages/modplatform/ModPage.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 231e98f67..9bb56290f 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -287,12 +287,15 @@ void ModPage::openUrl(const QUrl& url) newPage->ui->searchEdit->setText(slug); newPage->triggerSearch(); - connect(newPage->listModel->activeJob(), &Task::finished, [slug, newPage] { - for (int row = 0; row < newPage->listModel->rowCount({}); row++) { - QModelIndex index = newPage->listModel->index(row); - auto pack = newPage->listModel->data(index, Qt::UserRole).value(); + ModPlatform::ListModel* model = newPage->listModel; + QListView* view = newPage->ui->packView; + + 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(); if (pack.slug == slug) { - newPage->ui->packView->setCurrentIndex(index); + view->setCurrentIndex(index); break; } }