qt6windows7/examples/corelib/serialization/convert/variantorderedmap.h
2023-12-04 18:42:35 +01:00

25 lines
581 B
C++

// Copyright (C) 2018 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef VARIANTORDEREDMAP_H
#define VARIANTORDEREDMAP_H
#include <QList>
#include <QPair>
#include <QVariant>
#include <QVariantMap>
class VariantOrderedMap : public QList<QPair<QVariant, QVariant>>
{
public:
VariantOrderedMap() = default;
VariantOrderedMap(const QVariantMap &map)
{
reserve(map.size());
for (auto it = map.begin(); it != map.end(); ++it)
append({it.key(), it.value()});
}
};
#endif // VARIANTORDEREDMAP_H