QmlDesigner: Move isNodeVisible to NavigatorView

Change-Id: If1e73d218c2647074ecb198749b176b4618111b0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2017-05-11 10:35:26 +02:00
parent 5823de4e9c
commit 0732b9c094
4 changed files with 10 additions and 8 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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*/)
{
}

View File

@@ -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);