[Interest] ListView won't fall in line.

Gianluca gmaxera at gmail.com
Sun May 15 09:28:56 CEST 2016


What you write seems wrong to me. I don’t know what you want to achieve … 
but for me what you write (even if correctly from QML syntax) doesn’t seems right because ListView is meant to offer a scrollable viewport of it’s content and you wrote: "height: childrenRect.height” for setting the height of ListView that seems you want the height of the viewport of ListView big as all elements it contains … so you don’t need a scrollable Item … or you need ?!?!

Typically use of ListView consist on setting its height to you available height on the screen for display the Items. In your case, I would set: “height: applicationWindow.height - row.height”, so that the ListView will fill the remaining available space on the screen and it will eventually let you scroll the content inside.

Ciao,
Gianluca. 


Il giorno 14/mag/2016, alle ore 23:24, Kevin Mcintyre <kebin70 at gmail.com> ha scritto:

> // this seems wrong.  ListView doesn't heed column/row -- change to repeater acts as expected.
> 
> import QtQuick 2.5
> import QtQuick.Controls 1.4
> 
> ApplicationWindow {
>     width: 400
>     height: 400
>     visible: true
>     Column {
>         anchors.fill: parent
>         Row {
>             Label {
>                 text: 'Hello'
>             }
>         }
>         ListView {
>             height: childrenRect.height
>             id: view
>             header: Row {
>                 Label { text: 'Model - ' + view.model.count }
>             }
>             footer: Row {
>                 Label { text: 'Footer'}
>             }
>             model: ListModel {
>                 ListElement {
>                     modeltext: 'World'
>                 }
>                 ListElement {
>                     modeltext: 'Testing'
>                 }
>             }
>             delegate: Row {
>                 Label { text: modeltext }
>             }
>         }
>     }
> }
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list