Skip to content

Commit

Permalink
remove itemCache
Browse files Browse the repository at this point in the history
  • Loading branch information
octaeder committed Mar 1, 2024
1 parent 6abf003 commit f8eb6a5
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/macrobrowserui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,25 @@ MacroBrowserUI::~MacroBrowserUI()
networkManager->deleteLater();
networkManager=nullptr;
}
treeWidget->~QTreeWidget();
delete treeWidget;
}

QList<Macro> MacroBrowserUI::getSelectedMacros()
{
QList<Macro> lst;
foreach(QList<QTreeWidgetItem *>listOfItems,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;
}

Expand Down Expand Up @@ -212,7 +211,6 @@ void MacroBrowserUI::onRequestCompleted()
listOfItems<<item;
}
}
itemCache.insert(path,listOfItems);
}
}

Expand Down

0 comments on commit f8eb6a5

Please sign in to comment.