App: DocumentObject - New full label member function
==================================================== Before this commit there is a function getFullName(), which produces a string in the form document#objectname. For "document" the real name of the document is taken, whereas for objectname it is the initial name (Sketch, Sketch001), not the label. The new function fo this commit, getFullLabel(), provides a string documentlabel#documentobjectlabel, that are probably easier to identify for end users.
This commit is contained in:
committed by
abdullahtahiriyo
parent
c8c91c4f8e
commit
2dac347526
@@ -282,6 +282,16 @@ std::string DocumentObject::getFullName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string DocumentObject::getFullLabel() const {
|
||||
if(!getDocument())
|
||||
return "?";
|
||||
|
||||
auto name = getDocument()->Label.getStrValue();
|
||||
name += "#";
|
||||
name += Label.getStrValue();
|
||||
return name;
|
||||
}
|
||||
|
||||
const char *DocumentObject::getNameInDocument() const
|
||||
{
|
||||
// Note: It can happen that we query the internal name of an object even if it is not
|
||||
|
||||
@@ -140,6 +140,8 @@ public:
|
||||
std::string getExportName(bool forced=false) const;
|
||||
/// Return the object full name of the form DocName#ObjName
|
||||
std::string getFullName() const override;
|
||||
/// Return the object full label in the form DocName#ObjName
|
||||
std::string getFullLabel() const;
|
||||
bool isAttachedToDocument() const override;
|
||||
const char* detachFromDocument() override;
|
||||
/// gets the document in which this Object is handled
|
||||
|
||||
Reference in New Issue
Block a user