Account for margin in visibility icon click check
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user