forked from qt-creator/qt-creator
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:
committed by
Henning Gründl
parent
2860e57112
commit
4ba6c7988e
@@ -82,6 +82,12 @@ void IconCheckboxItemDelegate::paint(QPainter *painter,
|
|||||||
const QStyleOptionViewItem &styleOption,
|
const QStyleOptionViewItem &styleOption,
|
||||||
const QModelIndex &modelIndex) const
|
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))
|
if (rowIsPropertyRole(modelIndex.model(), modelIndex))
|
||||||
return; //Do not paint icons for property rows
|
return; //Do not paint icons for property rows
|
||||||
|
|
||||||
|
@@ -168,6 +168,7 @@ NavigatorTreeView::NavigatorTreeView(QWidget *parent)
|
|||||||
setMinimumWidth(240);
|
setMinimumWidth(240);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setIndentation(indentation() * 0.5);
|
setIndentation(indentation() * 0.5);
|
||||||
|
viewport()->setAttribute(Qt::WA_Hover);
|
||||||
|
|
||||||
m_toolTipHideTimer.setSingleShot(true);
|
m_toolTipHideTimer.setSingleShot(true);
|
||||||
connect(&m_toolTipHideTimer, &QTimer::timeout, [this]() {
|
connect(&m_toolTipHideTimer, &QTimer::timeout, [this]() {
|
||||||
|
Reference in New Issue
Block a user