Skip to content

Commit

Permalink
Fix tree item text not updating when changing page name or IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
dgelessus committed Mar 16, 2024
1 parent 6b732fe commit f9822d8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/PrpShop/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ void PrpShopMain::saveFile(plPageInfo* page, QString filename)
void PrpShopMain::saveProps(QPlasmaTreeItem* item)
{
if (item != NULL) {
bool reinit = false;
bool refreshTree = false;
if (item->type() == QPlasmaTreeItem::kTypePage) {
if (fAgeName->text() != st2qstr(item->page()->getAge())) {
Expand All @@ -1029,7 +1030,7 @@ void PrpShopMain::saveProps(QPlasmaTreeItem* item)
}
if (fPageName->text() != st2qstr(item->page()->getPage())) {
item->page()->setPage(qstr2st(fPageName->text()));
item->setText(0, fPageName->text());
reinit = true;
refreshTree = true;
}
if (fReleaseVersion->value() != (int)item->page()->getReleaseVersion())
Expand All @@ -1046,12 +1047,13 @@ void PrpShopMain::saveProps(QPlasmaTreeItem* item)
fLoadedLocations[loc] = fLoadedLocations[item->page()->getLocation()];
fLoadedLocations.erase(fLoadedLocations.find(item->page()->getLocation()));
fResMgr.ChangeLocation(item->page()->getLocation(), loc);
reinit = true;
}
} else if (item->type() == QPlasmaTreeItem::kTypeKO) {
if (item->obj() != NULL) {
if (fObjName->text() != st2qstr(item->obj()->getKey()->getName())) {
item->obj()->getKey()->setName(qstr2st(fObjName->text()));
item->setText(0, fObjName->text());
reinit = true;
refreshTree = true;
}
plLoadMask mask = item->obj()->getKey()->getLoadMask();
Expand All @@ -1061,6 +1063,10 @@ void PrpShopMain::saveProps(QPlasmaTreeItem* item)
item->obj()->getKey()->setCloneIDs(fCloneId->value(), fClonePlayerId->value());
}
}
if (reinit) {
item->reinit();
item->parent()->sortChildren(0, Qt::AscendingOrder);
}
if (refreshTree)
fBrowserTree->sortItems(0, Qt::AscendingOrder);
}
Expand Down

0 comments on commit f9822d8

Please sign in to comment.