From f8eb6a51b2a78964daebe4ff4ffc7a292e376cad Mon Sep 17 00:00:00 2001 From: octaeder <102688820+octaeder@users.noreply.github.com> Date: Fri, 1 Mar 2024 20:44:47 +0100 Subject: [PATCH] remove itemCache --- src/macrobrowserui.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/macrobrowserui.cpp b/src/macrobrowserui.cpp index 7cf5a0d918..f3a8a39c91 100644 --- a/src/macrobrowserui.cpp +++ b/src/macrobrowserui.cpp @@ -59,26 +59,25 @@ MacroBrowserUI::~MacroBrowserUI() networkManager->deleteLater(); networkManager=nullptr; } - treeWidget->~QTreeWidget(); + delete treeWidget; } QList MacroBrowserUI::getSelectedMacros() { QList lst; - foreach(QListlistOfItems,itemCache){ - foreach(auto *item,listOfItems){ - if(item->checkState(0)==Qt::Checked) { - QString url=item->data(0,UrlRole).toString(); - QString macroJson=cache.value(url); - if(!macroJson.isEmpty()){ - Macro m; - m.loadFromText(macroJson); - lst << m; - } + QTreeWidgetItemIterator it(treeWidget); + while (*it) { + if ((*it)->checkState(0)==Qt::Checked) { + QString url=(*it)->data(0,UrlRole).toString(); + QString macroJson=cache.value(url); + if(!macroJson.isEmpty()){ + Macro m; + m.loadFromText(macroJson); + lst << m; } } + ++it; } - return lst; } @@ -212,7 +211,6 @@ void MacroBrowserUI::onRequestCompleted() listOfItems<