QmlDesigner: Fix ItemLibraryEntry serialization

When data is read from QDataStream into Qt containers, it is simply
appended/inserted into the container rather than completely overwriting
the container contents. This isn't desirable when reading an
ItemLibraryEntry object from data stream, as the assumption is that we
want the entry to be exactly what was originally stored into the
stream.

Task-number: QDS-1815
Change-Id: Ifaee244b2b4e7326b6f10fde3faeb5218f505ee2
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-03-27 16:24:43 +02:00
parent 38a7bfe4eb
commit ea5b098bc1

View File

@@ -225,6 +225,10 @@ QDataStream& operator<<(QDataStream& stream, const ItemLibraryEntry &itemLibrary
QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
{
// Clear containers so that we don't simply append to them in case the object is reused
itemLibraryEntry.m_data->hints.clear();
itemLibraryEntry.m_data->properties.clear();
stream >> itemLibraryEntry.m_data->name;
stream >> itemLibraryEntry.m_data->typeName;
stream >> itemLibraryEntry.m_data->majorVersion;