Skip to content

Commit

Permalink
Added property names to undo commands (#4013)
Browse files Browse the repository at this point in the history
* Set Property 'foo'
* Add Property 'foo'
* Remove Property 'foo'

Currently I haven't touched "Rename Property" because I think it would
get a little too verbose if we mentioned two names.

However, the name does mention the full path of a property if it is
nested, separated by dots.
  • Loading branch information
bjorn authored Jan 12, 2025
1 parent e51770c commit 4c178f6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tiled/changeproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ SetProperty::SetProperty(Document *document,
for (Object *obj : objects)
mPreviousValues.append(obj->property(mName));

const auto fullName = mPath.join(QLatin1Char('.'));

if (mObjects.size() > 1 || mObjects.at(0)->hasProperty(mName))
setText(QCoreApplication::translate("Undo Commands", "Set Property"));
setText(QCoreApplication::translate("Undo Commands", "Set Property '%1'").arg(fullName));
else
setText(QCoreApplication::translate("Undo Commands", "Add Property"));
setText(QCoreApplication::translate("Undo Commands", "Add Property '%1'").arg(fullName));
}

void SetProperty::undo()
Expand Down Expand Up @@ -216,7 +218,7 @@ RemoveProperty::RemoveProperty(Document *document,
for (Object *obj : objects)
mPreviousValues.append(obj->property(mName));

setText(QCoreApplication::translate("Undo Commands", "Remove Property"));
setText(QCoreApplication::translate("Undo Commands", "Remove Property '%1'").arg(name));
}

void RemoveProperty::undo()
Expand Down

0 comments on commit 4c178f6

Please sign in to comment.