]> cloud.milkyroute.net Git - dolphin.git/commitdiff
KItemListController: don't create rubber band for a right click in an empty region
authorAmol Godbole <amolagodbole@gmail.com>
Tue, 2 Apr 2024 04:14:13 +0000 (23:14 -0500)
committerFelix Ernst <felixernst@kde.org>
Fri, 5 Apr 2024 13:47:10 +0000 (13:47 +0000)
Rubber band was being incorrectly created for a right click in an empty region.
Handle this case in KItemListController::onPress().

BUG: 484881

src/kitemviews/kitemlistcontroller.cpp

index 3ab20640cca0fc8a9c1c7cdc3f60f326039af5cb..2cda2987b14c378fff91ea3011dc2a79ee40b029 100644 (file)
@@ -1698,6 +1698,11 @@ bool KItemListController::onPress(const QPointF &pos, const Qt::KeyboardModifier
             rubberBand->setActive(false);
             m_view->setAutoScroll(false);
         }
+
+        if (!m_pressedIndex.has_value()) {
+            // We have a right-click in an empty region, don't create rubber band.
+            return true;
+        }
     }
 
     if (m_pressedIndex.has_value()) {