Setting contentX on Flickable is ignored.
-
Hi there,
In the following source, setting the contentX property is ignored.
Can anyone tell me why?@
import QtQuick 2.0Rectangle {
width: 360
height: 360Text { anchors.fill: parent text: "Info:" + "\n contentX:" + flickable.contentX + "\n contentWidth:" + flickable.contentWidth + "\n width:" + flickable.width } Rectangle { id: container anchors.top: parent.top anchors.right: parent.right anchors.margins: 10 width: 200; height: 100; color: "lightsteelblue" Rectangle { id: touchArea anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom width: 50 color: "cornsilk" } Flickable { id: flickable anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom width: 50 contentWidth: draggable.width contentHeight: draggable.height // This seems to have no effect at all contentX: 100 Rectangle { id: draggable width: 150; height: flickable.height; color: "#30ff0000" } } }
}
@To add to the confusion:
if you move the Flickable into the Rectangle (touchArea) and use the fill anchor, everything works as expected.@
import QtQuick 2.0Rectangle {
width: 360
height: 360Text { anchors.fill: parent text: "Info:" + "\n contentX:" + flickable.contentX + "\n contentWidth:" + flickable.contentWidth + "\n width:" + flickable.width } Rectangle { id: container anchors.top: parent.top anchors.right: parent.right anchors.margins: 10 width: 200; height: 100; color: "lightsteelblue" Rectangle { id: touchArea anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom width: 50 color: "cornsilk" Flickable { id: flickable anchors.fill: parent
// anchors.top: parent.top
// anchors.left: parent.left
// anchors.bottom: parent.bottom
// width: 50contentWidth: draggable.width contentHeight: draggable.height // This is set just fine contentX: 100 Rectangle { id: draggable width: 150; height: flickable.height; color: "#30ff0000" } } } }
}
@ -
Since I've not become any smarter and the community doesn't seem to have an answer too, I've issued this as a bug.
https://bugreports.qt-project.org/browse/QTBUG-30837