PropertyKey.h header

#include <ew/app/PropertyKey.h>

Namespace ew::app

Functions

QString ew::app::entity::propertyKeyForLabel(const ew::core::project::Project &project, ew::core::foundation::CategoryId categoryId, const ew::core::entity::Entity *entity, const QString &label)

The storage key a property with the display label label should use, given what categoryId (and optionally entity, for its own properties) can already see.

A property's KEY is what its values are stored under; its LABEL is only what the writer reads. Every surface that creates one has to agree on how the second becomes the first, and they did not: the desktop used the label verbatim while the MCP tools lower-cased it, so adding "Eye Color" in the app and then adding "Eye Color" over MCP produced TWO properties with the same label, keyed "Eye Color" and "eye color" – a form showing the field twice with the value in whichever half was written last.

So the rule lives here, once: an existing property whose label or key matches label case-insensitively keeps ITS key, and only a genuinely new property gets a fresh one (the trimmed, lower-cased label). Matching an existing key first is what makes this safe for projects that already hold either spelling – nothing is renamed, and no value moves.

Returns an empty string when label reduces to nothing, which callers must refuse: a property with no key has nowhere to store a value.