summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/controls/Private/ScrollViewHelper.qml9
-rw-r--r--src/controls/Private/qquickwheelarea.cpp21
-rw-r--r--src/controls/Private/qquickwheelarea_p.h6
-rw-r--r--src/controls/ScrollView.qml1
4 files changed, 32 insertions, 5 deletions
diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml
index 791c5e020..ccad20b23 100644
--- a/src/controls/Private/ScrollViewHelper.qml
+++ b/src/controls/Private/ScrollViewHelper.qml
@@ -59,6 +59,7 @@ Item {
property int contentWidth
property real originX
property real originY
+ property bool active
property int leftMargin: outerFrame ? root.__style.padding.left : 0
property int rightMargin: outerFrame ? root.__style.padding.right : 0
@@ -143,14 +144,14 @@ Item {
Binding {
target: hscrollbar.__panel
property: "raised"
- value: vscrollbar.active
+ value: vscrollbar.active || wheelarea.active
when: hscrollbar.isTransient
}
Binding {
target: hscrollbar.__panel
property: "visible"
value: true
- when: !hscrollbar.isTransient
+ when: !hscrollbar.isTransient || wheelarea.active
}
function flash() {
if (hscrollbar.isTransient) {
@@ -184,14 +185,14 @@ Item {
Binding {
target: vscrollbar.__panel
property: "raised"
- value: hscrollbar.active
+ value: hscrollbar.active || wheelarea.active
when: vscrollbar.isTransient
}
Binding {
target: vscrollbar.__panel
property: "visible"
value: true
- when: !vscrollbar.isTransient
+ when: !vscrollbar.isTransient || wheelarea.active
}
function flash() {
if (vscrollbar.isTransient) {
diff --git a/src/controls/Private/qquickwheelarea.cpp b/src/controls/Private/qquickwheelarea.cpp
index 101e22bf0..e276247be 100644
--- a/src/controls/Private/qquickwheelarea.cpp
+++ b/src/controls/Private/qquickwheelarea.cpp
@@ -66,7 +66,8 @@ QQuickWheelArea::QQuickWheelArea(QQuickItem *parent)
m_verticalValue(0),
m_verticalDelta(0),
m_horizontalDelta(0),
- m_scrollSpeed(defaultScrollSpeed)
+ m_scrollSpeed(defaultScrollSpeed),
+ m_active(false)
{
}
@@ -78,6 +79,11 @@ QQuickWheelArea::~QQuickWheelArea()
void QQuickWheelArea::wheelEvent(QWheelEvent *we)
{
+ if (we->phase() == Qt::ScrollBegin)
+ setActive(true);
+ else if (we->phase() == Qt::ScrollEnd)
+ setActive(false);
+
QPoint numPixels = we->pixelDelta();
QPoint numDegrees = we->angleDelta() / 8;
@@ -201,4 +207,17 @@ qreal QQuickWheelArea::scrollSpeed() const
return m_scrollSpeed;
}
+bool QQuickWheelArea::isActive() const
+{
+ return m_active;
+}
+
+void QQuickWheelArea::setActive(bool active)
+{
+ if (active != m_active) {
+ m_active = active;
+ emit activeChanged();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/controls/Private/qquickwheelarea_p.h b/src/controls/Private/qquickwheelarea_p.h
index 057ad56de..ebaa1453b 100644
--- a/src/controls/Private/qquickwheelarea_p.h
+++ b/src/controls/Private/qquickwheelarea_p.h
@@ -59,6 +59,7 @@ class QQuickWheelArea : public QQuickItem
Q_PROPERTY(qreal horizontalValue READ horizontalValue WRITE setHorizontalValue)
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)
public:
QQuickWheelArea(QQuickItem *parent = 0);
@@ -91,6 +92,9 @@ public:
void setScrollSpeed(qreal value);
qreal scrollSpeed() const;
+ bool isActive() const;
+ void setActive(bool active);
+
void wheelEvent(QWheelEvent *event);
Q_SIGNALS:
@@ -99,6 +103,7 @@ Q_SIGNALS:
void verticalWheelMoved();
void horizontalWheelMoved();
void scrollSpeedChanged();
+ void activeChanged();
private:
qreal m_horizontalMinimumValue;
@@ -110,6 +115,7 @@ private:
qreal m_verticalDelta;
qreal m_horizontalDelta;
qreal m_scrollSpeed;
+ bool m_active;
Q_DISABLE_COPY(QQuickWheelArea)
};
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml
index aa980ddd0..7d3d1d9d6 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -280,6 +280,7 @@ FocusScope {
ScrollViewHelper {
id: scroller
anchors.fill: parent
+ active: wheelArea.active
property bool outerFrame: !frameVisible || !(__style ? __style.__externalScrollBars : 0)
property int scrollBarSpacing: outerFrame ? 0 : (__style ? __style.__scrollBarSpacing : 0)
property int verticalScrollbarOffset: verticalScrollBar.visible && !verticalScrollBar.isTransient ?