From: Eugene Popov Date: Fri, 29 Mar 2024 16:49:40 +0000 (+0200) Subject: Fix selection marker for RTL X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/181c33a159e756eca65b60e36803af5614c6a7b4 Fix selection marker for RTL This MR makes the selection marker to be shown on the right in RTL mode. --- diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 0d3cfed1a..10494ba7e 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -536,6 +536,7 @@ QRectF KStandardItemListWidget::selectionToggleRect() const { const_cast(this)->triggerCacheRefreshing(); + const QRectF widgetIconRect = iconRect(); const int widgetIconSize = iconSize(); int toggleSize = KIconLoader::SizeSmall; if (widgetIconSize >= KIconLoader::SizeEnormous) { @@ -544,7 +545,7 @@ QRectF KStandardItemListWidget::selectionToggleRect() const toggleSize = KIconLoader::SizeSmallMedium; } - QPointF pos = iconRect().topLeft(); + QPointF pos = widgetIconRect.topLeft(); // If the selection toggle has a very small distance to the // widget borders, the size of the selection toggle will get @@ -565,6 +566,10 @@ QRectF KStandardItemListWidget::selectionToggleRect() const pos.setX(0); } + if (QApplication::isRightToLeft()) { + pos.setX(widgetIconRect.right() - (pos.x() + toggleSize - widgetIconRect.left())); + } + return QRectF(pos, QSizeF(toggleSize, toggleSize)); }