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/ScrollView.qml | |
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/ScrollView.qml')
-rw-r--r-- | src/controls/ScrollView.qml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml index 183991ac..3a7b031f 100644 --- a/src/controls/ScrollView.qml +++ b/src/controls/ScrollView.qml @@ -281,9 +281,21 @@ FocusScope { horizontalMinimumValue: 0 horizontalMaximumValue: flickableItem ? flickableItem.contentWidth - viewport.width : 0 + onHorizontalMaximumValueChanged: { + wheelArea.horizontalRecursionGuard = true + //if horizontalMaximumValue changed, horizontalValue may be actually synced with + wheelArea.horizontalValue = flickableItem.contentX - flickableItem.originX; + wheelArea.horizontalRecursionGuard = false + } verticalMinimumValue: 0 verticalMaximumValue: flickableItem ? flickableItem.contentHeight - viewport.height + __viewTopMargin : 0 + onVerticalMaximumValueChanged: { + wheelArea.verticalRecursionGuard = true + //if verticalMaximumValue changed, verticalValue may be actually synced with + wheelArea.verticalValue = flickableItem.contentY - flickableItem.originY; + wheelArea.verticalRecursionGuard = false + } // The default scroll speed for typical angle-based mouse wheels. The value // comes originally from QTextEdit, which sets 20px steps by default, as well as |