Gui: Do not lose thumbnail when saving partially loaded doc (#25458)

This commit is contained in:
PaddleStroke
2025-11-26 20:53:11 +01:00
committed by GitHub
parent 84ec0d1c77
commit 58d12221a5
2 changed files with 59 additions and 13 deletions

View File

@@ -1780,16 +1780,19 @@ void Document::Save(Base::Writer& writer) const
int size = hGrp->GetInt("ThumbnailSize", 256);
size = Base::clamp<int>(size, 64, 512);
std::list<MDIView*> mdi = getMDIViews();
View3DInventorViewer* view = nullptr;
for (const auto& it : mdi) {
if (it->isDerivedFrom<View3DInventor>()) {
View3DInventorViewer* view = static_cast<View3DInventor*>(it)->getViewer();
d->thumb.setFileName(d->_pcDocument->FileName.getValue());
d->thumb.setSize(size);
d->thumb.setViewer(view);
d->thumb.Save(writer);
view = static_cast<View3DInventor*>(it)->getViewer();
break;
}
}
d->thumb.setFileName(d->_pcDocument->FileName.getValue());
d->thumb.setSize(size);
d->thumb.setViewer(view);
d->thumb.Save(writer);
}
}
}