Hi All,
Im using QtCreator and have written a basic QML test app to demonstrate an issue i've been seeing..
Scenario:-
ListView component with more delegates than can fit in to the view. Delegates (for this demo) consist of a green rectangle with a blue border. There is a red rectangle which we append to the end of this listview to indicate that there are more items below. This red rectangles visible property is bound to the list views atYEnd. So when we are at the very bottom of the list view, the red rectangle should be hidden; otherwise, we display it.
Issue:-
Flick (not drag) to the end of the listview and the red rectangle will still be visible. It seems the atYEnd is not emitted. If you were to then take note of the bottom delegates position and select and drag up, you'll notice that the delegate hasn't moved, yet the red rectangle has disappeared; meaning the atYEnd has been received.
Has anyone come across this issue before and if so, did you find a work around to correctly detect the end of the list view?
Thanks in advance,
Rob.
import QtQuick 1.1
FocusScope {
id: main
width: 1280;
height: 786;
Text {
anchors.top: parent.top;
anchors.topMargin: 20;
anchors.horizontalCenter: parent.horizontalCenter;
text: "Flick listview to the end and it wont emmit the atYEnd! Then touch and drag->no movement since its at the end but we do then get the atYEnd signal!";
font.pixelSize: 16
}
Rectangle { //Use this to show listview area
anchors.fill: lstTestList;
color: "pink";
}
ListView {
id: lstTestList;
anchors.top: parent.top;
anchors.topMargin: 100;
anchors.horizontalCenter: parent.horizontalCenter;
width: 315;
height: 400;
focus: true;
clip: true;
snapMode: ListView.SnapToItem;
boundsBehavior: ListView.StopAtBounds;
highlightFollowsCurrentItem: true;
model: 7;
delegate: listViewDelegate;
Behavior on contentY {
NumberAnimation {
duration: main.timings.fastSlide;
onRunningChanged: lstTestList.bListMoving = running
}
}
}//listView
Component {
id: listViewDelegate;
FocusScope {
id: listViewDelegateItem;
width: childrenRect.width;
height: 80;
Rectangle {
width: 315;
height: parent.height;
border.width: 1;
border.color: "blue";
color: "green";
Text {
anchors.centerIn: parent;
text: "Delegate " + index
}
}
}//item
}//delegate component
Rectangle {
id: rctListMoreIndicator;
width: 315;
height: 80;
visible: !lstTestList.atYEnd;
anchors {
top: lstTestList.bottom;
left: lstTestList.left;
}
opacity: 1.0;
color: "red";
Text {
anchors.top: parent.top;
anchors.topMargin: 20;
anchors.horizontalCenter: parent.horizontalCenter;
width: 300;
wrapMode: Text.WordWrap;
text: "This should not appear when we are at the very end of the listview"
font.pixelSize: 16
}
} //rctListMoreIndicator
} //Main.qml
import QtQuick 1.1
FocusScope {
id: main
width: 1280;
height: 786;
Text {
anchors.top: parent.top;
anchors.topMargin: 20;
anchors.horizontalCenter: parent.horizontalCenter;
text: "Flick listview to the end and it wont emmit the atYEnd! Then touch and drag->no movement since its at the end but we do then get the atYEnd signal!";
font.pixelSize: 16
}
Rectangle { //Use this to show listview area
anchors.fill: lstTestList;
color: "pink";
}
ListView {
id: lstTestList;
anchors.top: parent.top;
anchors.topMargin: 100;
anchors.horizontalCenter: parent.horizontalCenter;
width: 315;
height: 400;
focus: true;
clip: true;
snapMode: ListView.SnapToItem;
boundsBehavior: ListView.StopAtBounds;
highlightFollowsCurrentItem: true;
model: 7;
delegate: listViewDelegate;
Behavior on contentY {
NumberAnimation {
duration: main.timings.fastSlide;
onRunningChanged: lstTestList.bListMoving = running
}
}
}//listView
Component {
id: listViewDelegate;
FocusScope {
id: listViewDelegateItem;
width: childrenRect.width;
height: 80;
Rectangle {
width: 315;
height: parent.height;
border.width: 1;
border.color: "blue";
color: "green";
Text {
anchors.centerIn: parent;
text: "Delegate " + index
}
}
}//item
}//delegate component
Rectangle {
id: rctListMoreIndicator;
width: 315;
height: 80;
visible: !lstTestList.atYEnd;
anchors {
top: lstTestList.bottom;
left: lstTestList.left;
}
opacity: 1.0;
color: "red";
Text {
anchors.top: parent.top;
anchors.topMargin: 20;
anchors.horizontalCenter: parent.horizontalCenter;
width: 300;
wrapMode: Text.WordWrap;
text: "This should not appear when we are at the very end of the listview"
font.pixelSize: 16
}
} //rctListMoreIndicator
} //Main.qml
To copy to clipboard, switch view to plain text mode
a
Bookmarks