]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix selection marker for RTL
authorEugene Popov <popov895@ukr.net>
Fri, 29 Mar 2024 16:49:40 +0000 (18:49 +0200)
committerMéven Car <meven.car@kdemail.net>
Sat, 30 Mar 2024 11:54:13 +0000 (11:54 +0000)
This MR makes the selection marker to be shown on the right in RTL mode.

src/kitemviews/kstandarditemlistwidget.cpp

index 0d3cfed1a596eacf888e3a230a8a58a2f890ed9f..10494ba7e199351399bb421846c8b333f91626d1 100644 (file)
@@ -536,6 +536,7 @@ QRectF KStandardItemListWidget::selectionToggleRect() const
 {
     const_cast<KStandardItemListWidget *>(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));
 }