Skip to content

Commit

Permalink
Gui: support multiple icons in tree view
Browse files Browse the repository at this point in the history
Add new API ViewProvider::getExtraIcons(), and
ViewProviderExtension::extensionGetExtraIcons().

Also allow extension through ViewProviderPythonFeature::getExtraIcons()
  • Loading branch information
realthunder committed Oct 4, 2020
1 parent 47227bd commit 6cb8c87
Show file tree
Hide file tree
Showing 14 changed files with 1,518 additions and 160 deletions.
22 changes: 3 additions & 19 deletions src/Gui/Document.cpp
Expand Up @@ -1436,14 +1436,8 @@ void Document::RestoreDocFile(Base::Reader &reader)
bool split = !!xmlReader.getAttributeAsInteger(FC_ATTR_SPLIT_XML,"0");

d->_hasExpansion = !!xmlReader.getAttributeAsInteger(FC_ATTR_TREE_EXPANSION,"0");
if(d->_hasExpansion) {
auto tree = TreeWidget::instance();
if(tree) {
auto docItem = tree->getDocumentItem(this);
if(docItem)
docItem->Restore(xmlReader);
}
}
if(d->_hasExpansion)
TreeWidget::restoreDocumentItem(this, xmlReader);

// At this stage all the document objects and their associated view providers exist.
// Now we must restore the properties of the view providers only.
Expand Down Expand Up @@ -1639,17 +1633,7 @@ void Document::SaveDocFile (Base::Writer &writer) const
<< "\" FileVersion=\"" << writer.getFileVersion() << "\" "
<< FC_ATTR_SPLIT_XML "=\"" << (writer.isSplitXML()?1:0) << "\"";

auto tree = TreeWidget::instance();
bool hasExpansion = false;
if(tree) {
auto docItem = tree->getDocumentItem(this);
if(docItem) {
hasExpansion = true;
writer.Stream() << " " FC_ATTR_TREE_EXPANSION "=\"1\">\n";
docItem->Save(writer);
}
}
if(!hasExpansion)
if (TreeWidget::saveDocumentItem(this, writer, FC_ATTR_TREE_EXPANSION))
writer.Stream() << ">\n";

if(writer.isSplitXML()) {
Expand Down
17 changes: 9 additions & 8 deletions src/Gui/Icons/Invisible.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6cb8c87

Please sign in to comment.