summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2019-03-21 14:29:14 +0200
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2019-03-21 13:08:54 +0000
commit1a3e241ff5dbb6f843e8f5ff5774ac2056f4a00c (patch)
tree4f527413a71e374b1c9a790687d47d8de0ac839d
parentcc601e282b218d369e60ea25a9245228c873fb4d (diff)
Don't create duplicate variant groups on import
Also don't update color for already existing groups. Task-number: QT3DS-3192 Change-Id: I0e81e351df26ffa11d66c9b2deca6b403caa6103 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Studio/Application/ProjectFile.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Authoring/Studio/Application/ProjectFile.cpp b/src/Authoring/Studio/Application/ProjectFile.cpp
index 98f5fa74..05a0b173 100644
--- a/src/Authoring/Studio/Application/ProjectFile.cpp
+++ b/src/Authoring/Studio/Application/ProjectFile.cpp
@@ -956,7 +956,7 @@ ProjectFile::getDiBindingtypesFromSubpresentations() const
*
* @param filePath the file path to load the variants from. If empty, variants are loaded from the
* project file and replace m_variantsDef. If a filePath is specified, the loaded
- * variants are merged with m_variantsDef
+ * variants are merged with m_variantsDef.
*/
void ProjectFile::loadVariants(const QString &filePath)
{
@@ -983,10 +983,13 @@ void ProjectFile::loadVariants(const QString &filePath)
if (reader.readNextStartElement()) {
if (reader.name() == QLatin1String("variantgroup")) {
QString groupId = reader.attributes().value(QLatin1String("id")).toString();
- QString groupColor = reader.attributes().value(QLatin1String("color")).toString();
currentGroup = &m_variantsDef[groupId];
- currentGroup->m_color = groupColor;
- m_variantsDefKeys.append(groupId);
+ if (!m_variantsDefKeys.contains(groupId)) {
+ // Only update colors for new groups
+ currentGroup->m_color = reader.attributes().value(
+ QLatin1String("color")).toString();
+ m_variantsDefKeys.append(groupId);
+ }
} else if (reader.name() == QLatin1String("variant")) {
if (currentGroup) {
QString tagId = reader.attributes().value(QLatin1String("id")).toString();