┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTravis Burrows <[email protected]>2022-05-26 12:38:22 +0000
committerFelix Ernst <[email protected]>2022-05-26 12:38:22 +0000
commit58622f431b0d7d347333a4bc7b2f57fe17878f9d (patch)
tree672fb5b994c3886ef6902cafa64d8f706c36d6a7 /src
parentca0d0bb322925e2119f13f76d8e9643d24cbf3e0 (diff)
Extend selection rectangle to left edge
This commit changes it so the sizes of selection rectangles and hover highlights in compact and details view mode is identical for all items. Before this commit, selection rectangles in lists would have varying indentation of the left edge of the selection rectangle depending on the preview image's width-to-height ratio. This would cause a sort of "ragged edge" in both compact and details list view when multiple items were selected. This commit doesn't change anything about icon view mode. BUG: 453046
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 7adcc8539..d0eef5ef4 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -1104,7 +1104,16 @@ void KStandardItemListWidget::updatePixmapCache()
}
- m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize));
+ if (m_layout == IconsLayout) {
+ m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize));
+ } else {
+ const qreal widthOffset = widgetIconSize - m_scaledPixmapSize.width();
+ const qreal heightOffset = widgetIconSize - m_scaledPixmapSize.height();
+ const QPointF squareIconPos(m_pixmapPos.x() - 0.5 * widthOffset,
+ m_pixmapPos.y() - 0.5 * heightOffset);
+ const QSizeF squareIconSize(widgetIconSize, widgetIconSize);
+ m_iconRect = QRectF(squareIconPos, squareIconSize);
+ }
// Prepare the pixmap that is used when the item gets hovered
if (isHovered()) {