forked from qt-creator/qt-creator
QmlDesigner: Keep the order of columns in CollectionEditor
Fixes: QDS-11508 Change-Id: Ic75f86207149469ed4b08605db9feb10c4e1141d Reviewed-by: Shrief Gabr <shrief.gabr@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -20,17 +20,27 @@ namespace {
|
||||
|
||||
QStringList getJsonHeaders(const QJsonArray &collectionArray)
|
||||
{
|
||||
QSet<QString> result;
|
||||
QSet<QString> resultSet;
|
||||
QList<QString> result;
|
||||
|
||||
for (const QJsonValue &value : collectionArray) {
|
||||
if (value.isObject()) {
|
||||
const QJsonObject object = value.toObject();
|
||||
const QStringList headers = object.toVariantMap().keys();
|
||||
for (const QString &header : headers)
|
||||
result.insert(header);
|
||||
QJsonObject::ConstIterator element = object.constBegin();
|
||||
const QJsonObject::ConstIterator stopItem = object.constEnd();
|
||||
|
||||
while (element != stopItem) {
|
||||
const QString property = element.key();
|
||||
if (!resultSet.contains(property)) {
|
||||
result.append(property);
|
||||
resultSet.insert(property);
|
||||
}
|
||||
++element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.values();
|
||||
return result;
|
||||
}
|
||||
|
||||
class CollectionDataTypeHelper
|
||||
|
Reference in New Issue
Block a user