QmlDesigner: Use reverse iterators to support qualified scopes

Change-Id: I88a4dcbff7a50f399b81a948f273e9cf9e36782d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Thomas Hartmann
2024-05-13 15:08:25 +02:00
parent 7ffd4805ca
commit 22657af3f0
2 changed files with 9 additions and 6 deletions

View File

@@ -43,17 +43,20 @@ public:
EnumerationNameView scope() const EnumerationNameView scope() const
{ {
auto found = std::find(m_enumerationName.begin(), m_enumerationName.end(), '.'); auto found = std::find(m_enumerationName.rbegin(), m_enumerationName.rend(), '.');
return {m_enumerationName.begin(), found}; if (found != m_enumerationName.rend())
return {m_enumerationName.begin(), std::prev(found.base())};
return {m_enumerationName.end(), m_enumerationName.end()};
} }
EnumerationNameView toScope() const { return scope().toByteArray(); } EnumerationNameView toScope() const { return scope().toByteArray(); }
EnumerationNameView name() const EnumerationNameView name() const
{ {
auto found = std::find(m_enumerationName.begin(), m_enumerationName.end(), '.'); auto found = std::find(m_enumerationName.rbegin(), m_enumerationName.rend(), '.');
if (found != m_enumerationName.end()) if (found != m_enumerationName.rend())
return {std::next(found), m_enumerationName.end()}; return {found.base(), m_enumerationName.end()};
return {m_enumerationName.end(), m_enumerationName.end()}; return {m_enumerationName.end(), m_enumerationName.end()};
} }

View File

@@ -142,7 +142,7 @@ void PropertyEditorValue::setValue(const QVariant &value)
QString PropertyEditorValue::enumeration() const QString PropertyEditorValue::enumeration() const
{ {
return m_value.value<Enumeration>().nameToString().split('.').last(); return m_value.value<Enumeration>().nameToString();
} }
QString PropertyEditorValue::expression() const QString PropertyEditorValue::expression() const