QmlDesigner: Icon visibility in navigator

Show alias, visibility and lock icons in the navigator only when either
checked or hovered.

Task-number: QDS-2785
Change-Id: I1eca1b9f44cfbdd839daa64849156e1c9ffa4acd
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2020-10-09 14:35:34 +02:00
committed by Henning Gründl
parent 2860e57112
commit 4ba6c7988e
2 changed files with 7 additions and 0 deletions

View File

@@ -82,6 +82,12 @@ void IconCheckboxItemDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &styleOption,
const QModelIndex &modelIndex) const
{
bool isVisibilityIcon = modelIndex.column() != NavigatorTreeModel::ColumnType::Visibility;
// We need to invert the check status if visibility icon
bool checked = isVisibilityIcon ? isChecked(modelIndex) : !isChecked(modelIndex);
if (!(styleOption.state & QStyle::State_MouseOver) && !checked)
return;
if (rowIsPropertyRole(modelIndex.model(), modelIndex))
return; //Do not paint icons for property rows

View File

@@ -168,6 +168,7 @@ NavigatorTreeView::NavigatorTreeView(QWidget *parent)
setMinimumWidth(240);
setRootIsDecorated(false);
setIndentation(indentation() * 0.5);
viewport()->setAttribute(Qt::WA_Hover);
m_toolTipHideTimer.setSingleShot(true);
connect(&m_toolTipHideTimer, &QTimer::timeout, [this]() {