diff options
author | Marco Martin <mart@kde.org> | 2017-03-21 16:34:48 +0100 |
---|---|---|
committer | Marco Martin <notmart@gmail.com> | 2017-04-03 15:44:52 +0000 |
commit | 378bd7b4454a5a049072ae1043981984f30e8329 (patch) | |
tree | 44a7cc08ba7b008cae6e6dce5beed320ffb0576e /src/controls/Private | |
parent | edc24e3cd75eaf02a587f50b14dbd0288447179d (diff) | |
download | qtquickcontrols-378bd7b4454a5a049072ae1043981984f30e8329.tar.gz |
Add NOTIFY signals for WheelArea5.8
the private WheelArea component didn't have any notify signals
in its horizontalValue/verticalValue or minimum/maximum
values as well. this caused old values to be used in ScrollView.qml.
If we want to have a listView that starts scrolled right when instanced,
verticalMaximumValue won't be updated when the list is populated.
Also, the wheelArea.verticalValue that's assigned at the beginning will
be constrained by the wrong verticalMaximumValue, causing it to go out of
sync with contentY. At this point the first time the mouse wheel is
moved, the list will jump back at the top.
Change-Id: I4605000636be7975ba9a58e2c79e8c2351e5a292
Task-number: QTBUG-59633
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/controls/Private')
-rw-r--r-- | src/controls/Private/qquickwheelarea.cpp | 16 | ||||
-rw-r--r-- | src/controls/Private/qquickwheelarea_p.h | 16 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/controls/Private/qquickwheelarea.cpp b/src/controls/Private/qquickwheelarea.cpp index 9c0a70a2..bd77ae24 100644 --- a/src/controls/Private/qquickwheelarea.cpp +++ b/src/controls/Private/qquickwheelarea.cpp @@ -141,7 +141,11 @@ void QQuickWheelArea1::wheelEvent(QWheelEvent *we) void QQuickWheelArea1::setHorizontalMinimumValue(qreal value) { + if (value == m_horizontalMinimumValue) + return; + m_horizontalMinimumValue = value; + emit horizontalMinimumValueChanged(); } qreal QQuickWheelArea1::horizontalMinimumValue() const @@ -151,7 +155,11 @@ qreal QQuickWheelArea1::horizontalMinimumValue() const void QQuickWheelArea1::setHorizontalMaximumValue(qreal value) { + if (value == m_horizontalMaximumValue) + return; + m_horizontalMaximumValue = value; + emit horizontalMaximumValueChanged(); } qreal QQuickWheelArea1::horizontalMaximumValue() const @@ -161,7 +169,11 @@ qreal QQuickWheelArea1::horizontalMaximumValue() const void QQuickWheelArea1::setVerticalMinimumValue(qreal value) { + if (value == m_verticalMinimumValue) + return; + m_verticalMinimumValue = value; + emit verticalMinimumValueChanged(); } qreal QQuickWheelArea1::verticalMinimumValue() const @@ -171,7 +183,11 @@ qreal QQuickWheelArea1::verticalMinimumValue() const void QQuickWheelArea1::setVerticalMaximumValue(qreal value) { + if (value == m_verticalMaximumValue) + return; + m_verticalMaximumValue = value; + emit verticalMaximumValueChanged(); } qreal QQuickWheelArea1::verticalMaximumValue() const diff --git a/src/controls/Private/qquickwheelarea_p.h b/src/controls/Private/qquickwheelarea_p.h index 676383bc..a11b78cf 100644 --- a/src/controls/Private/qquickwheelarea_p.h +++ b/src/controls/Private/qquickwheelarea_p.h @@ -50,12 +50,12 @@ class QQuickWheelArea1 : public QQuickItem Q_OBJECT Q_PROPERTY(qreal verticalDelta READ verticalDelta WRITE setVerticalDelta NOTIFY verticalWheelMoved) Q_PROPERTY(qreal horizontalDelta READ horizontalDelta WRITE setHorizontalDelta NOTIFY horizontalWheelMoved) - Q_PROPERTY(qreal horizontalMinimumValue READ horizontalMinimumValue WRITE setHorizontalMinimumValue) - Q_PROPERTY(qreal horizontalMaximumValue READ horizontalMaximumValue WRITE setHorizontalMaximumValue) - Q_PROPERTY(qreal verticalMinimumValue READ verticalMinimumValue WRITE setVerticalMinimumValue) - Q_PROPERTY(qreal verticalMaximumValue READ verticalMaximumValue WRITE setVerticalMaximumValue) - Q_PROPERTY(qreal horizontalValue READ horizontalValue WRITE setHorizontalValue) - Q_PROPERTY(qreal verticalValue READ verticalValue WRITE setVerticalValue) + Q_PROPERTY(qreal horizontalMinimumValue READ horizontalMinimumValue WRITE setHorizontalMinimumValue NOTIFY horizontalMinimumValueChanged) + Q_PROPERTY(qreal horizontalMaximumValue READ horizontalMaximumValue WRITE setHorizontalMaximumValue NOTIFY horizontalMaximumValueChanged) + Q_PROPERTY(qreal verticalMinimumValue READ verticalMinimumValue WRITE setVerticalMinimumValue NOTIFY verticalMinimumValueChanged) + Q_PROPERTY(qreal verticalMaximumValue READ verticalMaximumValue WRITE setVerticalMaximumValue NOTIFY verticalMaximumValueChanged) + Q_PROPERTY(qreal horizontalValue READ horizontalValue WRITE setHorizontalValue NOTIFY horizontalValueChanged) + Q_PROPERTY(qreal verticalValue READ verticalValue WRITE setVerticalValue NOTIFY verticalValueChanged) 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) @@ -106,7 +106,11 @@ public: Q_SIGNALS: void verticalValueChanged(); + void verticalMinimumValueChanged(); + void verticalMaximumValueChanged(); void horizontalValueChanged(); + void horizontalMinimumValueChanged(); + void horizontalMaximumValueChanged(); void verticalWheelMoved(); void horizontalWheelMoved(); void scrollSpeedChanged(); |