┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2013-06-20 19:02:06 +0200
committerEmmanuel Pescosta <[email protected]>2013-06-20 19:02:06 +0200
commit584574e07d17b6ec2b82882c8c9869f5e8597e4e (patch)
tree04fa2a0d5a5708d7ab58146d6ecfb414bc58b6ad
parent75ed1946f8743bc924d28a49ca87df1392f1d408 (diff)
Prevent the selection rectangle from being reduced to 0px
width or 0px height, so the selected items can not be accidently unselected when the rectangle width/height becomes 0px. BUG: 320897 REVIEW: 111144 FIXED-IN: 4.10.5
-rw-r--r--src/kitemviews/private/kitemlistrubberband.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistrubberband.cpp b/src/kitemviews/private/kitemlistrubberband.cpp
index ae023d2aa..58567c460 100644
--- a/src/kitemviews/private/kitemlistrubberband.cpp
+++ b/src/kitemviews/private/kitemlistrubberband.cpp
@@ -50,6 +50,22 @@ void KItemListRubberBand::setEndPosition(const QPointF& pos)
if (m_endPos != pos) {
const QPointF previous = m_endPos;
m_endPos = pos;
+
+ if (m_startPos.x() == m_endPos.x()) {
+ if (previous.x() < m_startPos.x()) {
+ m_endPos.rx() = m_startPos.x() - 1.0;
+ } else {
+ m_endPos.rx() = m_startPos.x() + 1.0;
+ }
+ }
+ if (m_startPos.y() == m_endPos.y()) {
+ if (previous.y() < m_startPos.y()) {
+ m_endPos.ry() = m_startPos.y() - 1.0;
+ } else {
+ m_endPos.ry() = m_startPos.y() + 1.0;
+ }
+ }
+
emit endPositionChanged(m_endPos, previous);
}
}