summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@theqtcompany.com>2015-08-25 12:19:21 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-03-15 10:34:00 +0000
commita275fb3d29d5560af22ef5c4a721ce9bf2a2ccc1 (patch)
treef9111c918bacbf4dd1c2df6c5b98effe0514bacc /src/controls/Private
parent101c1c5e466befc8f58f2eca35265dd32ea9f66a (diff)
downloadqtquickcontrols-a275fb3d29d5560af22ef5c4a721ce9bf2a2ccc1.tar.gz
Correct scrolling direction when using Sliders
Account for OS X "direct"/"inverted"/"australian" scrolling. This ensures that a touchpad right/left/up/down flick will move the slider handle in the same direction as the flick. This takes advantage of the recent addition of QWheelEvent::inverted in qtbase Change-Id: If51ec6f0cbc12a042a92aa55964633c9521469a9 Task-number: QTBUG-35972 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/qquickwheelarea.cpp7
-rw-r--r--src/controls/Private/qquickwheelarea_p.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/controls/Private/qquickwheelarea.cpp b/src/controls/Private/qquickwheelarea.cpp
index c49460b5..2afddf3e 100644
--- a/src/controls/Private/qquickwheelarea.cpp
+++ b/src/controls/Private/qquickwheelarea.cpp
@@ -95,6 +95,11 @@ bool QQuickWheelArea::isAtYBeginning() const
return qFuzzyCompare(m_verticalMinimumValue, m_verticalValue);
}
+bool QQuickWheelArea::isInverted() const
+{
+ return m_inverted;
+}
+
#ifndef QT_NO_WHEELEVENT
void QQuickWheelArea::wheelEvent(QWheelEvent *we)
{
@@ -106,6 +111,8 @@ void QQuickWheelArea::wheelEvent(QWheelEvent *we)
QPoint numPixels = we->pixelDelta();
QPoint numDegrees = we->angleDelta() / 8;
+ m_inverted = we->inverted();
+
if (!numPixels.isNull()) {
setHorizontalDelta(numPixels.x() * pixelDeltaAdjustment);
setVerticalDelta(numPixels.y() * pixelDeltaAdjustment);
diff --git a/src/controls/Private/qquickwheelarea_p.h b/src/controls/Private/qquickwheelarea_p.h
index b66b147c..077b24d4 100644
--- a/src/controls/Private/qquickwheelarea_p.h
+++ b/src/controls/Private/qquickwheelarea_p.h
@@ -58,6 +58,7 @@ class QQuickWheelArea : public QQuickItem
Q_PROPERTY(qreal verticalValue READ verticalValue WRITE setVerticalValue)
Q_PROPERTY(qreal scrollSpeed READ scrollSpeed WRITE setScrollSpeed NOTIFY scrollSpeedChanged)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
+ Q_PROPERTY(bool inverted READ isInverted)
public:
QQuickWheelArea(QQuickItem *parent = 0);
@@ -92,6 +93,7 @@ public:
bool isActive() const;
void setActive(bool active);
+ bool isInverted() const;
#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event);
@@ -121,6 +123,7 @@ private:
qreal m_horizontalDelta;
qreal m_scrollSpeed;
bool m_active;
+ bool m_inverted;
Q_DISABLE_COPY(QQuickWheelArea)
};