Commit 3e1234c8 authored by Tim Jenssen's avatar Tim Jenssen Committed by Thomas Hartmann
Browse files

QmlDesigner: disable none default properties in navigator



Change-Id: Ia5c6e4c34ef40145f0fa7618a1ceb5afb1f666b3
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 76fbc65c
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include <QtDebug> #include <QtDebug>
#define DISABLE_VISIBLE_PROPERTIES
namespace QmlDesigner { namespace QmlDesigner {
static PropertyNameList visibleProperties(const ModelNode &node) static PropertyNameList visibleProperties(const ModelNode &node)
...@@ -84,7 +86,9 @@ static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode) ...@@ -84,7 +86,9 @@ static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
if (parentNode.metaInfo().hasDefaultProperty()) if (parentNode.metaInfo().hasDefaultProperty())
properties.append(parentNode.metaInfo().defaultPropertyName()); properties.append(parentNode.metaInfo().defaultPropertyName());
#ifndef DISABLE_VISIBLE_PROPERTIES
properties.append(visibleProperties(parentNode)); properties.append(visibleProperties(parentNode));
#endif
foreach (const PropertyName &propertyName, properties) { foreach (const PropertyName &propertyName, properties) {
AbstractProperty property(parentNode.property(propertyName)); AbstractProperty property(parentNode.property(propertyName));
...@@ -201,7 +205,9 @@ static bool computeTarget(const QModelIndex &rowModelIndex, ...@@ -201,7 +205,9 @@ static bool computeTarget(const QModelIndex &rowModelIndex,
ModelNode targetNode = navigatorTreeModel->nodeForIndex(targetItemIndex); ModelNode targetNode = navigatorTreeModel->nodeForIndex(targetItemIndex);
if (!targetNode.metaInfo().hasDefaultProperty()) if (!targetNode.metaInfo().hasDefaultProperty())
return false; return false;
#ifndef DISABLE_VISIBLE_PROPERTIES
*targetRowNumber -= visibleProperties(targetNode).count(); *targetRowNumber -= visibleProperties(targetNode).count();
#endif
targetPropertyName = targetNode.metaInfo().defaultPropertyName(); targetPropertyName = targetNode.metaInfo().defaultPropertyName();
} else { } else {
targetItemIndex = rowModelIndex.parent(); targetItemIndex = rowModelIndex.parent();
...@@ -280,6 +286,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node) ...@@ -280,6 +286,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
visibilityItem->setCheckable(false); visibilityItem->setCheckable(false);
QMap<QString, QStandardItem *> propertyItems; QMap<QString, QStandardItem *> propertyItems;
#ifndef DISABLE_VISIBLE_PROPERTIES
foreach (const QString &propertyName, visibleProperties(node)) { foreach (const QString &propertyName, visibleProperties(node)) {
QStandardItem *propertyItem = new QStandardItem; QStandardItem *propertyItem = new QStandardItem;
propertyItem->setSelectable(false); propertyItem->setSelectable(false);
...@@ -290,6 +297,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node) ...@@ -290,6 +297,7 @@ ItemRow NavigatorTreeModel::createItemRow(const ModelNode &node)
propertyItems.insert(propertyName, propertyItem); propertyItems.insert(propertyName, propertyItem);
idItem->appendRow(propertyItem); idItem->appendRow(propertyItem);
} }
#endif
# ifdef _LOCK_ITEMS_ # ifdef _LOCK_ITEMS_
ItemRow newRow = ItemRow(idItem, lockItem, visibilityItem, propertyItems); ItemRow newRow = ItemRow(idItem, lockItem, visibilityItem, propertyItems);
...@@ -340,7 +348,9 @@ static void findTargetItem(const NodeListProperty &listProperty, ...@@ -340,7 +348,9 @@ static void findTargetItem(const NodeListProperty &listProperty,
*targetItem = parentRow.propertyItems.value(listProperty.name()); *targetItem = parentRow.propertyItems.value(listProperty.name());
} else { // default property } else { // default property
*targetItem = parentRow.idItem; *targetItem = parentRow.idItem;
#ifndef DISABLE_VISIBLE_PROPERTIES
newRowNumber += visibleProperties(listProperty.parentModelNode()).count(); newRowNumber += visibleProperties(listProperty.parentModelNode()).count();
#endif
} }
} else { } else {
*targetItem = currentItemRow.idItem->parent(); *targetItem = currentItemRow.idItem->parent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment