forked from qt-creator/qt-creator
Timeline: Bind to Flickable's width for scrolling
The setup of ScrollView and Flickable will otherwise generate a spurious contentX change that messes up our range position. Change-Id: I04f41b206a7ef4f0a889448f36103f427d1330d7 Task-number: QTCREATORBUG-19656 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -68,7 +68,6 @@ ScrollView {
|
|||||||
// switch to non-interactive ourselves, though.
|
// switch to non-interactive ourselves, though.
|
||||||
property bool stayInteractive: true
|
property bool stayInteractive: true
|
||||||
onStayInteractiveChanged: flick.interactive = stayInteractive
|
onStayInteractiveChanged: flick.interactive = stayInteractive
|
||||||
onWidthChanged: scroll()
|
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: flick
|
id: flick
|
||||||
@@ -89,6 +88,15 @@ ScrollView {
|
|||||||
recursionGuard = false;
|
recursionGuard = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Logically we should bind to scroller.width above as we use scroller.width in scroll().
|
||||||
|
// However, this width changes before scroller.width when the window is resized and if we
|
||||||
|
// don't explicitly set contentX here, for some reason an automatic change in contentX is
|
||||||
|
// triggered after this width has changed, but before scroller.width changes. This would be
|
||||||
|
// indistinguishabe from a manual flick by the user and thus changes the range position. We
|
||||||
|
// don't want to change the range position on resizing the window. Therefore we bind to this
|
||||||
|
// width.
|
||||||
|
onWidthChanged: scroll()
|
||||||
|
|
||||||
// Update the zoom control on scrolling.
|
// Update the zoom control on scrolling.
|
||||||
onContentXChanged: guarded(function() {
|
onContentXChanged: guarded(function() {
|
||||||
var newStartTime = contentX * zoomer.rangeDuration / scroller.width
|
var newStartTime = contentX * zoomer.rangeDuration / scroller.width
|
||||||
|
|||||||
Reference in New Issue
Block a user