Commit 0732b9c0 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Move isNodeVisible to NavigatorView

Change-Id: If1e73d218c2647074ecb198749b176b4618111b0
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 5823de4e
......@@ -247,6 +247,8 @@ QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
const ModelNode modelNode = modelNodeForIndex(index);
const QmlObjectNode currentQmlObjectNode(modelNode);
QTC_ASSERT(m_view, return QVariant());
if (!modelNode.isValid())
return QVariant();
if (index.column() == 0) {
......@@ -279,7 +281,7 @@ QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
"This is independent of the visibility property in QML.");
} else if (index.column() == 2) { //visible
if (role == Qt::CheckStateRole)
return isNodeVisible(modelNode) ? Qt::Unchecked : Qt::Checked;
return m_view->isNodeVisible(modelNode) ? Qt::Unchecked : Qt::Checked;
else if (role == Qt::ToolTipRole)
return tr("Toggles whether this item is exported as an "
"alias property of the root item.");
......@@ -703,14 +705,9 @@ void NavigatorTreeModel::notifyModelNodesMoved(const QList<ModelNode> &modelNode
layoutChanged(indexes);
}
bool NavigatorTreeModel::isNodeVisible(const ModelNode &modelNode) const
{
return modelNode.auxiliaryData("invisible").toBool();
}
bool NavigatorTreeModel::isNodeVisible(const QModelIndex &index) const
{
return isNodeVisible(modelNodeForIndex(index));
return m_view->isNodeVisible(modelNodeForIndex(index));
}
bool NavigatorTreeModel::hasError(const QModelIndex &index) const
......
......@@ -89,7 +89,6 @@ public:
void notifyModelNodesRemoved(const QList<ModelNode> &modelNodes);
void notifyModelNodesInserted(const QList<ModelNode> &modelNodes);
void notifyModelNodesMoved(const QList<ModelNode> &modelNodes);
bool isNodeVisible(const ModelNode &modelNode) const;
bool isNodeVisible(const QModelIndex &index) const;
bool hasError(const QModelIndex &index) const;
......
......@@ -198,6 +198,11 @@ void NavigatorView::handleChangedExport(const ModelNode &modelNode, bool exporte
}
}
bool NavigatorView::isNodeVisible(const ModelNode &modelNode) const
{
return modelNode.auxiliaryData("invisible").toBool();
}
void NavigatorView::nodeAboutToBeRemoved(const ModelNode & /*removedNode*/)
{
}
......
......@@ -76,6 +76,7 @@ public:
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags) override;
void handleChangedExport(const ModelNode &modelNode, bool exported);
bool isNodeVisible(const ModelNode &modelNode) const;
private:
void changeSelection(const QItemSelection &selected, const QItemSelection &deselected);
......
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