diff options
author | Robert Griebl <robert.griebl@qt.io> | 2020-11-20 23:56:08 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2020-11-28 17:47:47 +0100 |
commit | f4762958325130c9ec37ccb4b191368ef1412add (patch) | |
tree | 2c2977eb14dfe9466366c24c166ca956403662a7 /src/common-lib/qtyaml.cpp | |
parent | 911ee1f92017f22f9aa1fd430b414ff28c7e0cbe (diff) |
Qt6 port, part 2 .. compiling with cmake
Change-Id: I0b3b0bd420fc2b5a5d263439ef263a8214bbdb4b
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src/common-lib/qtyaml.cpp')
-rw-r--r-- | src/common-lib/qtyaml.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/common-lib/qtyaml.cpp b/src/common-lib/qtyaml.cpp index 4144d4bd..e597e709 100644 --- a/src/common-lib/qtyaml.cpp +++ b/src/common-lib/qtyaml.cpp @@ -83,30 +83,30 @@ static void emitYaml(yaml_emitter_t *e, const QVariant &value, YamlStyle style) { yaml_event_t event; - switch (value.type()) { + switch (value.metaType().id()) { default: - case QVariant::Invalid: + case QMetaType::UnknownType: emitYamlScalar(e, "~"); break; - case QVariant::Bool: + case QMetaType::Bool: emitYamlScalar(e, value.toBool() ? "true" : "false"); break; - case QVariant::Int: - case QVariant::LongLong: + case QMetaType::Int: + case QMetaType::LongLong: emitYamlScalar(e, QByteArray::number(value.toLongLong())); break; - case QVariant::UInt: - case QVariant::ULongLong: + case QMetaType::UInt: + case QMetaType::ULongLong: emitYamlScalar(e, QByteArray::number(value.toULongLong())); break; - case QVariant::Double: + case QMetaType::Double: emitYamlScalar(e, QByteArray::number(value.toDouble())); break; - case QVariant::String: + case QMetaType::QString: emitYamlScalar(e, value.toString().toUtf8(), true); break; - case QVariant::List: - case QVariant::StringList: { + case QMetaType::QVariantList: + case QMetaType::QStringList: { yerr(yaml_sequence_start_event_initialize(&event, nullptr, nullptr, 1, style == FlowStyle ? YAML_FLOW_SEQUENCE_STYLE : YAML_BLOCK_SEQUENCE_STYLE)); yerr(yaml_emitter_emit(e, &event)); @@ -118,7 +118,7 @@ static void emitYaml(yaml_emitter_t *e, const QVariant &value, YamlStyle style) yerr(yaml_emitter_emit(e, &event)); break; } - case QVariant::Map: { + case QMetaType::QVariantMap: { yerr(yaml_mapping_start_event_initialize(&event, nullptr, nullptr, 1, style == FlowStyle ? YAML_FLOW_MAPPING_STYLE : YAML_BLOCK_MAPPING_STYLE)); yerr(yaml_emitter_emit(e, &event)); @@ -477,7 +477,7 @@ QString YamlParser::parseMapKey() { if (isScalar()) { QVariant key = parseScalar(); - if (key.type() == QVariant::String) + if (key.metaType() == QMetaType::fromType<QString>()) return key.toString(); } throw YamlParserException(this, "Only strings are supported as mapping keys"); |