Commit 52a5aec7 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlDesigner.Navigator: Fixed reparenting of items as children of invisible items

parent e5367131
......@@ -176,6 +176,8 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
}
}
propagateInvisible(parentItemNode, isNodeInvisible(parentIdIndex));
return false; // don't let the view do drag&drop on its own
}
......@@ -281,7 +283,7 @@ void NavigatorTreeModel::handleChangedItem(QStandardItem *item)
bool invisible = (item->checkState() == Qt::Unchecked);
node.setAuxiliaryData("invisible", invisible);
propagateInvisible(node,invisible);
propagateInvisible(node,isNodeInvisible(node));
}
}
......@@ -290,7 +292,6 @@ void NavigatorTreeModel::propagateInvisible(const ModelNode &node, const bool &i
QList <ModelNode> children = node.allDirectSubModelNodes();
foreach (ModelNode child, children) {
child.setAuxiliaryData("childOfInvisible",invisible);
bool childIsInvisible = child.auxiliaryData("invisible").toBool();
if (!child.auxiliaryData("invisible").toBool())
propagateInvisible(child,invisible);
}
......@@ -358,7 +359,11 @@ bool NavigatorTreeModel::isInTree(const ModelNode &node) const
bool NavigatorTreeModel::isNodeInvisible(const QModelIndex &index) const
{
ModelNode node = nodeForIndex(index);
return isNodeInvisible(nodeForIndex(index));
}
bool NavigatorTreeModel::isNodeInvisible(const ModelNode &node) const
{
bool nodeInvisible = node.auxiliaryData("invisible").toBool();
if (node.hasAuxiliaryData("childOfInvisible"))
nodeInvisible = nodeInvisible || node.auxiliaryData("childOfInvisible").toBool();
......
......@@ -100,6 +100,7 @@ public:
bool isInTree(const ModelNode &node) const;
void propagateInvisible(const ModelNode &node, const bool &invisible);
bool isNodeInvisible(const QModelIndex &index) const;
bool isNodeInvisible(const ModelNode &node) const;
void addSubTree(const ModelNode &node);
void removeSubTree(const ModelNode &node);
......
......@@ -103,7 +103,6 @@ void NavigatorTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &o
QTreeView::drawRow(painter,options,index);
painter->setPen(QColor(_separator_line_color_));
painter->drawLine(options.rect.bottomLeft(),options.rect.bottomRight());
// painter->drawLine(options.rect.topLeft(),options.rect.topRight());
painter->restore();
}
......
......@@ -45,6 +45,7 @@ NavigatorWidget::NavigatorWidget(QWidget* parent) :
m_treeView->setDragEnabled(true);
m_treeView->setAcceptDrops(true);
m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_treeView->header()->setStretchLastSection(false);
m_treeView->setDefaultDropAction(Qt::LinkAction);
......
Supports Markdown
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