summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@nokia.com>2009-05-14 13:28:47 (GMT)
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2009-05-14 13:28:47 (GMT)
commited52c2f402b99541553aac163029d217f1dcd419 (patch)
tree63eda93777256cf5d6db5223f58fe58137004204 /src/gui
parentb038c1ac6bdac15b123946821bbff3ee25bfad2b (diff)
downloadQt-ed52c2f402b99541553aac163029d217f1dcd419.zip
Qt-ed52c2f402b99541553aac163029d217f1dcd419.tar.gz
Qt-ed52c2f402b99541553aac163029d217f1dcd419.tar.bz2
Remove snapback/maximum drag distance from QSlider
This feature was only intended for QScrollBar and was incorrectly inherited by QSlider. The only supported platform that use this feature seems to be Windows so instead of doing a nasty qobject cast in the styling it makes more sense to remove the functionality from QSlider entirely. Task-number: 245681 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/widgets/qslider.cpp10
2 files changed, 1 insertions, 11 deletions
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index b73332f..514f67b 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1332,7 +1332,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_LayoutVerticalSpacing Default \l{QLayout::spacing}{vertical spacing} for a QLayout.
\value PM_MaximumDragDistance The maximum allowed distance between
- the mouse and a slider when dragging. Exceeding the specified
+ the mouse and a scrollbar when dragging. Exceeding the specified
distance will cause the slider to jump back to the original
position; a value of -1 disables this behavior.
diff --git a/src/gui/widgets/qslider.cpp b/src/gui/widgets/qslider.cpp
index 32b9021..5b9c8a4 100644
--- a/src/gui/widgets/qslider.cpp
+++ b/src/gui/widgets/qslider.cpp
@@ -62,7 +62,6 @@ public:
int tickInterval;
QSlider::TickPosition tickPosition;
int clickOffset;
- int snapBackPosition;
void init();
void resetLayoutItemMargins();
int pixelPosToRangeValue(int pos) const;
@@ -493,7 +492,6 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
setRepeatAction(SliderNoAction);
QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
d->clickOffset = d->pick(ev->pos() - sr.topLeft());
- d->snapBackPosition = d->position;
update(sr);
setSliderDown(true);
}
@@ -513,14 +511,6 @@ void QSlider::mouseMoveEvent(QMouseEvent *ev)
int newPosition = d->pixelPosToRangeValue(d->pick(ev->pos()) - d->clickOffset);
QStyleOptionSlider opt;
initStyleOption(&opt);
- int m = style()->pixelMetric(QStyle::PM_MaximumDragDistance, &opt, this);
- if (m >= 0) {
- QRect r = rect();
- r.adjust(-m, -m, m, m);
- if (!r.contains(ev->pos())) {
- newPosition = d->snapBackPosition;
- }
- }
setSliderPosition(newPosition);
}