Qt6 API fixes: QJsonObject and QJsonDocument serialization
- training_area_telegrams.cpp:3168: Fixed QJsonObject initializer list syntax
- Changed QJsonObject({{...}}) to QJsonObject{{...}} (double braces)
- Changed header.toJson() to header().toJson() (method call)
- track_content_widget.cpp:37,51: Fixed QJsonDocument serialization
- Replaced toBinaryData() with toJson(QJsonDocument::Compact)
- Replaced fromBinaryData() with fromJson()
- Qt6 removed binary serialization methods
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
8d456c7d1a
commit
3d3c3b48fe
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -34,7 +34,7 @@ namespace LtsScriptTimeline
|
||||
|
||||
QDataStream& operator<<(QDataStream& ds, const TrackEntry& te)
|
||||
{
|
||||
const QByteArray jsonContent = QJsonDocument(te.m_detailData).toBinaryData();
|
||||
const QByteArray jsonContent = QJsonDocument(te.m_detailData).toJson(QJsonDocument::Compact);
|
||||
ds << te.m_topicId << te.m_startTime << te.m_length << static_cast<quint8>(te.m_type) << te.isSet << te.index
|
||||
<< jsonContent << te.x << te.y << te.h << te.w << te.m_channelName << te.m_description;
|
||||
return ds;
|
||||
@@ -48,7 +48,7 @@ QDataStream& operator>>(QDataStream& ds, TrackEntry& te)
|
||||
te.y >> te.h >> te.w >> te.m_channelName >> te.m_description;
|
||||
|
||||
te.m_type = static_cast<TrackEntryType>(type);
|
||||
te.m_detailData = QJsonDocument::fromBinaryData(jsonContent).object();
|
||||
te.m_detailData = QJsonDocument::fromJson(jsonContent).object();
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3165,14 +3165,14 @@ BatteryAlarm BatteryAlarm::fromJson(const QJsonObject &obj)
|
||||
|
||||
QJsonObject BatteryAlarm::toJson() const
|
||||
{
|
||||
return QJsonObject({{QStringLiteral("header"), header.toJson()},
|
||||
return QJsonObject{{QStringLiteral("header"), header().toJson()},
|
||||
{QStringLiteral("id"), id},
|
||||
{QStringLiteral("description"), description},
|
||||
{QStringLiteral("acknowledge"), acknowledge},
|
||||
{QStringLiteral("condition"), condition},
|
||||
{QStringLiteral("uniqueAlarmNumber"), uniqueAlarmNumber},
|
||||
{QStringLiteral("alarmTime"), alarmTime}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
ServiceControl ServiceControl::fromJson(const QJsonObject &obj)
|
||||
|
||||
Reference in new issue
Block a user