From 16063554da1431e5c477899182325278e162b9b6 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 2 May 2016 15:46:23 +0200 Subject: [PATCH] QmlDesigner: fix showing a new component in item library view with vcs - not completely sure why this fixed the issue Change-Id: I3e514c64246831899511774cada4497ce86f5b7d Reviewed-by: Thomas Hartmann --- .../qmljscomponentfromobjectdef.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index 0e929e46635..89671830eaf 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -198,6 +198,19 @@ public: } } + QString replacement = componentName + QLatin1String(" {\n"); + if (!m_idName.isEmpty()) + replacement += QLatin1String("id: ") + m_idName + QLatin1Char('\n'); + + foreach (const QString &property, result) + replacement += property + QLatin1String(": ") + propertyReader.readAstValue(property) + QLatin1Char('\n'); + + Utils::ChangeSet changes; + changes.replace(start, end, replacement); + currentFile->setChangeSet(changes); + currentFile->appendIndentRange(Range(start, end + 1)); + currentFile->apply(); + Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(path); if (versionControl && versionControl->supportsOperation(Core::IVersionControl::AddOperation)) { @@ -212,19 +225,6 @@ public: Core::VcsManager::msgToAddToVcsFailed(QStringList(newFileName), versionControl)); } } - - QString replacement = componentName + QLatin1String(" {\n"); - if (!m_idName.isEmpty()) - replacement += QLatin1String("id: ") + m_idName + QLatin1Char('\n'); - - foreach (const QString &property, result) - replacement += property + QLatin1String(": ") + propertyReader.readAstValue(property) + QLatin1Char('\n'); - - Utils::ChangeSet changes; - changes.replace(start, end, replacement); - currentFile->setChangeSet(changes); - currentFile->appendIndentRange(Range(start, end + 1)); - currentFile->apply(); } };