Description (copied from the upstream bug I created)
According to Flickable's documentation, widthRatio and heightRatio define
"the percentage of the full view currently visible, scaled to 0.0 - 1.0".
At the moment, defining leftMargin so that
leftMargin+contentWidth < flickable.width
causes widthRatio to be wrongly evaluated to something != 1, whereas it should be 1, because Flickable's defaults at -leftMargin
(see https://github.com/qtproject/qtdeclarative/blob/5.6/src/quick/items/qquickflickable.cpp#L1592 ).
and when contentX is -leftMargin, the whole content fits inside the view.
As a consequence of that, in the current implementation you can also scroll the item from the testcase left and right, which shouldn't be possible (because item+margin are still smaller than the view).
UPSTREAM BUG: https:/ /bugreports. qt.io/browse/ QTBUG-53726
Description (copied from the upstream bug I created)
According to Flickable's documentation, widthRatio and heightRatio define contentWidth < flickable.width /github. com/qtproject/ qtdeclarative/ blob/5. 6/src/quick/ items/qquickfli ckable. cpp#L1592 ).
"the percentage of the full view currently visible, scaled to 0.0 - 1.0".
At the moment, defining leftMargin so that
leftMargin+
causes widthRatio to be wrongly evaluated to something != 1, whereas it should be 1, because Flickable's defaults at -leftMargin
(see https:/
and when contentX is -leftMargin, the whole content fits inside the view.
As a consequence of that, in the current implementation you can also scroll the item from the testcase left and right, which shouldn't be possible (because item+margin are still smaller than the view).
======= =TESTCASE= ======= ====
import QtQuick 2.0
Flickable { onCompleted: console.log("xPos", flickable. visibleArea. xPosition, "widthRatio", flickable. visibleArea. widthRatio) visibleArea
onXPositionCha nged: console. log("xPosChange d", flickable. visibleArea. xPosition)
onWidthRatioCh anged: console. log("widthRatio Changed" , flickable. visibleArea. widthRatio)
id: flickable
width: 200
height: 200
contentWidth: item.width
contentHeight: item.height
topMargin: 20
leftMargin: 40
Component.
Connections {
target: flickable.
}
Rectangle {
id: item
width: 100
height: 100
color: "black"
}
}
======= ======= ======= ======
How to reproduce:
1) qmlscene testcase.qml
2) watch the console output
Actual result: widthRatio is != 1
Expected result: widthRatio == 1