OSDN Git Service

QmlDesigner.propertyEditor: fixes anchoring in flickable
authorThomas Hartmann <Thomas.Hartmann@nokia.com>
Fri, 1 Apr 2011 11:53:40 +0000 (13:53 +0200)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>
Fri, 1 Apr 2011 12:00:45 +0000 (14:00 +0200)
Searching through "children" is not enough since
some items have default properties like "flickableChildren".
So we mimic instanceChildren here by taking all subnodes and
comparing the instanceParent.

Reviewed-by: Kai Koehne
src/plugins/qmldesigner/components/propertyeditor/siblingcombobox.cpp

index d0d0174..b1b54e9 100644 (file)
@@ -74,9 +74,15 @@ void SiblingComboBox::setup()
     connect(this, SIGNAL(currentIndexChanged (int)), this, SLOT(changeSelection(int)));
     if (!m_itemNode.isValid())
         return;
-    m_itemList = m_itemNode.instanceParent().toQmlItemNode().children();
+
+    if (m_itemNode.instanceParent().modelNode().isValid())
+        m_itemList = toQmlItemNodeList(m_itemNode.instanceParent().modelNode().allDirectSubModelNodes());
     m_itemList.removeOne(m_itemNode);
-    
+    //We currently have no instanceChildren().
+    //So we double check here if the instanceParents are equal.
+    foreach (const QmlItemNode &node, m_itemList)
+        if (node.instanceParent().modelNode() != m_itemNode.instanceParent().modelNode())
+            m_itemList.removeAll(node);
 
     disconnect(this, SIGNAL(currentIndexChanged (int)), this, SLOT(changeSelection(int)));
     clear();