modified ViewProviderPart to show different icon for Assembly-Type

This commit is contained in:
Zoltan Hubert
2021-07-17 19:46:17 +02:00
parent a7492d1934
commit c4b6f36485
5 changed files with 669 additions and 90 deletions

View File

@@ -57,6 +57,7 @@ ViewProviderPart::ViewProviderPart()
initExtension(this);
sPixmap = "Geofeaturegroup.svg";
aPixmap = "Geoassembly.svg";
}
ViewProviderPart::~ViewProviderPart()
@@ -112,6 +113,20 @@ bool ViewProviderPart::doubleClicked(void)
return true;
}
QIcon ViewProviderPart::getIcon(void) const
{
// the original Part object for this ViewProviderPart
App::Part* part = static_cast<App::Part*>(this->getObject());
// the normal case for Std_Part
const char* pixmap = sPixmap;
std::string type = part->Type.getStrValue();
// if it's flagged as an Assembly in its Type, it gets another icon
if (type == "Assembly") { pixmap = aPixmap; }
return mergeGreyableOverlayIcons (Gui::BitmapFactory().pixmap(pixmap));
}
// Python feature -----------------------------------------------------------------------
namespace Gui {