diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 1833a75523..3432e8ad63 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1608,15 +1608,19 @@ void TreeWidget::mousePressEvent(QMouseEvent* event) // Rect occupied by the item relative to viewport auto iconRect = visualItemRect(objitem); + auto style = this->style(); + // If the checkboxes are visible, these are displayed before the icon // and we have to compensate for its width. if (isSelectionCheckBoxesEnabled()) { - auto style = this->style(); int checkboxWidth = style->pixelMetric(QStyle::PM_IndicatorWidth) + style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); iconRect.adjust(checkboxWidth, 0, 0, 0); } + int const margin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; + iconRect.adjust(margin, 0, 0, 0); + // We are interested in the first icon (visibility icon) iconRect.setWidth(iconSize());