diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 2d08cb50c6..0c644db283 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -37,6 +37,8 @@ # include #endif +#include + #include #include #include @@ -3528,8 +3530,7 @@ void LinkSelection::select() { Gui::Selection().clearSelection(); Gui::Selection().addSelection((const char*)link[0].toLatin1(), - (const char*)link[1].toLatin1(), - link.size()>=6?(const char*)link[5].toUtf8():0); + (const char*)link[1].toLatin1()); this->deleteLater(); } @@ -3668,18 +3669,46 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const objName = _objName.c_str(); } - if(xlink && xlink->getSubName(false)[0]) { - auto subObj = obj->getSubObject(xlink->getSubName(false)); - if(subObj) - list << QString::fromLatin1("%1 (%2.%3)"). - arg(QString::fromUtf8(subObj->Label.getValue()), - QString::fromLatin1(objName), - QString::fromUtf8(xlink->getSubName(false))); - else - list << QString::fromLatin1("%1.%2"). - arg(QString::fromLatin1(objName), - QString::fromUtf8(xlink->getSubName(false))); - }else if(objName!=obj->Label.getValue()) { + if(xlink && xlink->getSubValues().size()) { + int count = 0; + std::stringstream ss; + ss << objName << ' '; + + std::string prevSub; + for(const auto &sub : xlink->getSubValues(false)) { + if(++count > 3) + break; + + if(count>1) + ss << ','; + else + ss << '('; + + auto element = Data::ComplexGeoData::findElementName(sub.c_str()); + if(prevSub.size()==(std::size_t)(element-sub.c_str()) + && boost::starts_with(sub,prevSub)) + { + ss << element; + continue; + } + + prevSub.clear(); + + if(element && element[0]) + prevSub = sub.substr(0,element-sub.c_str()); + + if(count > 1) + ss << ' '; + ss << sub; + } + if(count) { + if(count>3) + ss << "..."; + ss << ')'; + } + list << QString::fromUtf8(ss.str().c_str()); + + }else if(obj->Label.getStrValue() != objName) { list << QString::fromLatin1("%1 (%2)"). arg(QString::fromUtf8(obj->Label.getValue()), QString::fromLatin1(objName));