QmlDesigner: Stabilize property order of meta data

This reduces noise in the source control system.

Task-number: QTCREATORBUG-20686
Change-Id: Icf7d0d5b1af288f3518594233086917f039a47a0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2018-07-03 09:52:34 +02:00
parent 417a6db087
commit aeb192a814

View File

@@ -49,6 +49,7 @@
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/qmljssimplereader.h> #include <qmljs/qmljssimplereader.h>
#include <utils/algorithm.h>
#include <utils/changeset.h> #include <utils/changeset.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -483,14 +484,20 @@ QString RewriterView::auxiliaryDataAsQML() const
str += QString::number(node.internalId()); str += QString::number(node.internalId());
str += ";"; str += ";";
for (auto i = data.begin(); i != data.end(); ++i) { QStringList keys = Utils::transform(data.keys(), [](const PropertyName &name) {
const QVariant value = i.value(); return QString::fromUtf8(name);
});
keys.sort();
for (const QString &key : keys) {
const QVariant value = data.value(key.toUtf8());
QString strValue = value.toString(); QString strValue = value.toString();
if (static_cast<QMetaType::Type>(value.type()) == QMetaType::QString) if (static_cast<QMetaType::Type>(value.type()) == QMetaType::QString)
strValue = "\"" + strValue + "\""; strValue = "\"" + strValue + "\"";
if (!strValue.isEmpty()) { if (!strValue.isEmpty()) {
str += replaceIllegalPropertyNameChars(QString::fromUtf8(i.key())) + ":"; str += replaceIllegalPropertyNameChars(key) + ":";
str += strValue; str += strValue;
str += ";"; str += ";";
} }