forked from qt-creator/qt-creator
QmlDesigner: Fix navigator root icons clickable
* Fix root item icon columns clickable * Hide tooltip for root item icons Task-number: QDS-3006 Change-Id: Icd6177bfce30724bb4806aeec4768232760b35e9 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
985f6073da
commit
2c91080502
@@ -247,19 +247,19 @@ QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
} else if (index.column() == ColumnType::Alias) { // export
|
} else if (index.column() == ColumnType::Alias) { // export
|
||||||
if (role == Qt::CheckStateRole)
|
if (role == Qt::CheckStateRole)
|
||||||
return currentQmlObjectNode.isAliasExported() ? Qt::Checked : Qt::Unchecked;
|
return currentQmlObjectNode.isAliasExported() ? Qt::Checked : Qt::Unchecked;
|
||||||
else if (role == Qt::ToolTipRole)
|
else if (role == Qt::ToolTipRole && !modelNodeForIndex(index).isRootNode())
|
||||||
return tr("Toggles whether this item is exported as an "
|
return tr("Toggles whether this item is exported as an "
|
||||||
"alias property of the root item.");
|
"alias property of the root item.");
|
||||||
} else if (index.column() == ColumnType::Visibility) { // visible
|
} else if (index.column() == ColumnType::Visibility) { // visible
|
||||||
if (role == Qt::CheckStateRole)
|
if (role == Qt::CheckStateRole)
|
||||||
return m_view->isNodeInvisible(modelNode) ? Qt::Unchecked : Qt::Checked;
|
return m_view->isNodeInvisible(modelNode) ? Qt::Unchecked : Qt::Checked;
|
||||||
else if (role == Qt::ToolTipRole)
|
else if (role == Qt::ToolTipRole && !modelNodeForIndex(index).isRootNode())
|
||||||
return tr("Toggles the visibility of this item in the form editor.\n"
|
return tr("Toggles the visibility of this item in the form editor.\n"
|
||||||
"This is independent of the visibility property in QML.");
|
"This is independent of the visibility property in QML.");
|
||||||
} else if (index.column() == ColumnType::Lock) { // lock
|
} else if (index.column() == ColumnType::Lock) { // lock
|
||||||
if (role == Qt::CheckStateRole)
|
if (role == Qt::CheckStateRole)
|
||||||
return modelNode.locked() ? Qt::Checked : Qt::Unchecked;
|
return modelNode.locked() ? Qt::Checked : Qt::Unchecked;
|
||||||
else if (role == Qt::ToolTipRole)
|
else if (role == Qt::ToolTipRole && !modelNodeForIndex(index).isRootNode())
|
||||||
return tr("Toggles whether this item is locked.\n"
|
return tr("Toggles whether this item is locked.\n"
|
||||||
"Locked items can't be modified or selected.");
|
"Locked items can't be modified or selected.");
|
||||||
}
|
}
|
||||||
@@ -269,6 +269,14 @@ QVariant NavigatorTreeModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
Qt::ItemFlags NavigatorTreeModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags NavigatorTreeModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
|
if (modelNodeForIndex(index).isRootNode()) {
|
||||||
|
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled;
|
||||||
|
if (index.column() == ColumnType::Name)
|
||||||
|
return flags | Qt::ItemIsEditable;
|
||||||
|
else
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
if (index.column() == ColumnType::Alias
|
if (index.column() == ColumnType::Alias
|
||||||
|| index.column() == ColumnType::Visibility
|
|| index.column() == ColumnType::Visibility
|
||||||
|| index.column() == ColumnType::Lock)
|
|| index.column() == ColumnType::Lock)
|
||||||
|
Reference in New Issue
Block a user