]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Simplify rubberband selection for views that have only one column
authorPeter Penz <peter.penz19@gmail.com>
Sat, 20 Aug 2011 21:02:02 +0000 (23:02 +0200)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 20 Aug 2011 21:04:01 +0000 (23:04 +0200)
In this case the rubberband automatically uses the whole width of
the view.

src/kitemviews/kitemlistcontroller.cpp

index 31a1cfc2f0c2a4b253cdd2d0761742a506083057..50c39c18bcf61e8ccd47307602b4375f59ee0bbc 100644 (file)
@@ -285,6 +285,11 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const
         QPointF startPos = pos;
         if (m_view->scrollOrientation() == Qt::Vertical) {
             startPos.ry() += m_view->offset();
+            if (m_view->itemSize().width() < 0) {
+                // Use a special rubberband for views that have only one column and
+                // expand the rubberband to use the whole width of the view.
+                startPos.setX(0);
+            }
         } else {
             startPos.rx() += m_view->offset();
         }
@@ -308,6 +313,11 @@ bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent* event, const
         QPointF endPos = transform.map(event->pos());
         if (m_view->scrollOrientation() == Qt::Vertical) {
             endPos.ry() += m_view->offset();
+            if (m_view->itemSize().width() < 0) {
+                // Use a special rubberband for views that have only one column and
+                // expand the rubberband to use the whole width of the view.
+                endPos.setX(m_view->size().width());
+            }
         } else {
             endPos.rx() += m_view->offset();
         }