How to increase the "scrolling height" of a Qml ListView?
-
wrote on 12 Jul 2018, 00:21 last edited by daljit97 7 Dec 2018, 00:22
So I have got a qml
ListView
and the bottom of the list I have got a little banner that is visible at all times. Now this works fine, but when I scroll the list to the end the bottom of the list is obviously covered by the banner. How can increase the amount of "scrolling height" so that the user is able to scroll further until the list is completely visible?ListView{ id: lisView anchors.fill: parent } Banner{ id: banner width: listView.width/2 anchors.bottom: parent.bottom }
-
wrote on 12 Jul 2018, 05:56 last edited by DavidM29 7 Dec 2018, 07:06
You can put your ListView into a Rectangle or an Item with the size of your available space.
Here is an example :
Rectangle{ // Can be replace with Item id: lisView height: parent.height-banner.height // Make sure to set height or width or you could lose the scroll width: parent.width ListView{ // Your ListView you can put what you want in it spacing : 2 model : 30 delegate: Rectangle { height: 20 width: 50 border.color: "black" border.width: 1 color: "blue" } anchors.fill: parent } } Rectangle{ // did not have your banner component so I replaced it with a rectangle but the idea is the same id: banner width: parent.width height: 50 opacity: 0.4 //Set the opacity to make sure their is no more elements to show on the bottom of the ListView anchors.bottom: parent.bottom }
Hope this help
-
wrote on 12 Jul 2018, 13:18 last edited by
The problem is that I want my list to visible behind the banner (which is transparent). Your solution would constrain me to make the list on top of the banner.
-
wrote on 12 Jul 2018, 13:25 last edited by ODБOï 7 Dec 2018, 16:42This post is deleted!
-
wrote on 12 Jul 2018, 13:26 last edited by DavidM29 7 Dec 2018, 13:34
-
wrote on 12 Jul 2018, 13:28 last edited by
Can you layout the banner below the view rather than on top?
-
wrote on 12 Jul 2018, 16:31 last edited by
@DavidM29 So what I want is the list to be partial visible behind the transparent banner (like in your 2nd screenshot), however when the user scrolls up they are able to scroll until the content of the
ListView
sits on top of the banner. -
Qt Champions 2018wrote on 12 Jul 2018, 22:50 last edited by GrecKo 7 Dec 2018, 22:58
Add
bottomMargin: banner.height
to yourListView
EDIT: and as @shaan7 said, a
footer
with az: 2
andfooterPositioning: ListView.OverlayFooter
works too. -
Add
bottomMargin: banner.height
to yourListView
EDIT: and as @shaan7 said, a
footer
with az: 2
andfooterPositioning: ListView.OverlayFooter
works too. -
@GrecKo setting the
bottomMargin
will make the view sit on top of the banner. I want the list to be behind the transparent banner and when the user is nearly at the end they can scroll the content above the bannner@daljit97 said in How to increase the "scrolling height" of a Qml ListView?:
@GrecKo setting the
bottomMargin
will make the view sit on top of the banner.No, it has nothing to do with that.
Just place the banner on top of yourListView
's delegate.
If your banner is a child of yourListView
, setz: 2
.
If it's a sibling of theListView
, declare it after or with a higherz
.See http://doc.qt.io/qt-5/qml-qtquick-item.html#z-prop and http://doc.qt.io/qt-5/qml-qtquick-listview.html#stacking-order-in-listview
7/13