┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-08-20 23:02:02 +0200
committerPeter Penz <[email protected]>2011-08-20 23:04:01 +0200
commitc9f4e1baae0822d0af5b5bf4d4e4af870fcb664f (patch)
tree681c69d9bb9facf8827fedb98f4fa06853757096 /src
parent4aedb0767490989ea00251a39b8d76f1b51a4303 (diff)
Simplify rubberband selection for views that have only one column
In this case the rubberband automatically uses the whole width of the view.
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kitemlistcontroller.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index 31a1cfc2f..50c39c18b 100644
--- a/src/kitemviews/kitemlistcontroller.cpp
+++ b/src/kitemviews/kitemlistcontroller.cpp
@@ -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();
}