From cae134166b1d63c6969477ddd1a86e4d33bf48cc Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 25 Jan 2024 13:53:29 -0600 Subject: [PATCH] Instead of calling the count() method every time, assign to a variable It's just a little cleaner to read this way --- mainwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 54fe954..33df457 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -45,7 +45,9 @@ void MainWindow::setUpdateInfo(QList updateInfo) bool installEnabled = false; for (int i = 0;i < 4;i++) { - if (updateInfo[i].count() > 0) { + int count = updateInfo[i].count(); + + if (count > 0) { installEnabled = true; } @@ -65,7 +67,7 @@ void MainWindow::setUpdateInfo(QList updateInfo) break; } - for (int j = 0;j < updateInfo[i].count();j++) { + for (int j = 0;j < count;j++) { // TODO: Add security update detection here - security updates should be marked in some way installItem->addChild(new QTreeWidgetItem(QStringList() << updateInfo[i][j])); }