OSDN Git Service

QmlDesigner.documentController: fix for subcomponents
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Thu, 21 Jul 2011 13:40:56 +0000 (15:40 +0200)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>
Thu, 21 Jul 2011 13:44:12 +0000 (15:44 +0200)
The change to master model has to be before extractText().

Change-Id: I7e791098ddec8cbc8bd597e4ef4fdb97ef01a6e4
Reviewed-on: http://codereview.qt.nokia.com/1961
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp

index 52757cb..a18aca8 100644 (file)
@@ -394,20 +394,20 @@ void DesignDocumentController::changeCurrentModelTo(const ModelNode &componentNo
     QWeakPointer<Model> oldModel = m_d->model;
     Q_ASSERT(oldModel.data());
 
+    if (m_d->model == m_d->subComponentModel) {
+        changeToMasterModel();
+    }
+
     QString componentText = m_d->rewriterView->extractText(QList<ModelNode>() << componentNode).value(componentNode);
 
     if (componentText.isEmpty())
         return;
 
-
     bool explicitComponent = false;
     if (componentText.contains("Component")) { //explicit component
         explicitComponent = true;
     }
 
-    if (m_d->model == m_d->subComponentModel) {
-        changeToMasterModel();
-    }
     if (!componentNode.isRootNode()) {
         Q_ASSERT(m_d->model == m_d->masterModel);
         Q_ASSERT(componentNode.isValid());