Gui: fix tree view expansion restore

This commit is contained in:
Zheng, Lei
2022-09-03 00:36:31 +05:00
committed by Uwe
parent 1b26292d3c
commit e30f7bf920
+16 -11
View File
@@ -3940,17 +3940,22 @@ void DocumentItem::Save(Base::Writer& writer) const {
saveExpandedItem(writer, this);
}
void DocumentItem::Restore(Base::XMLReader& reader) {
reader.readElement("Expand");
if (!reader.hasAttribute("count"))
return;
_ExpandInfo.reset(new ExpandInfo);
_ExpandInfo->restore(reader);
for (auto inst : TreeWidget::Instances) {
if (inst != getTree()) {
auto docItem = inst->getDocumentItem(document());
if (docItem)
docItem->_ExpandInfo = _ExpandInfo;
void DocumentItem::Restore(Base::XMLReader &reader) {
int guard;
_ExpandInfo.reset();
reader.readElement("Expand",&guard);
if(reader.hasAttribute("count")) {
_ExpandInfo.reset(new ExpandInfo);
_ExpandInfo->restore(reader);
}
reader.readEndElement("Expand",&guard);
if(_ExpandInfo) {
for(auto inst : TreeWidget::Instances) {
if(inst!=getTree()) {
auto docItem = inst->getDocumentItem(document());
if(docItem)
docItem->_ExpandInfo = _ExpandInfo;
}
}
}
}