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)
|
QStringList getJsonHeaders(const QJsonArray &collectionArray)
|
||||||
{
|
{
|
||||||
QSet<QString> result;
|
QSet<QString> resultSet;
|
||||||
|
QList<QString> result;
|
||||||
|
|
||||||
for (const QJsonValue &value : collectionArray) {
|
for (const QJsonValue &value : collectionArray) {
|
||||||
if (value.isObject()) {
|
if (value.isObject()) {
|
||||||
const QJsonObject object = value.toObject();
|
const QJsonObject object = value.toObject();
|
||||||
const QStringList headers = object.toVariantMap().keys();
|
QJsonObject::ConstIterator element = object.constBegin();
|
||||||
for (const QString &header : headers)
|
const QJsonObject::ConstIterator stopItem = object.constEnd();
|
||||||
result.insert(header);
|
|
||||||
|
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
|
class CollectionDataTypeHelper
|
||||||
|
Reference in New Issue
Block a user