Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 1.0
- Rectangle {
- width: 400
- height: 300
- color: "lightyellow"
- property int lineHeight: 30
- Component {
- id: demoDelegate
- Rectangle {
- color: "lightblue"
- width: 120
- height: lineHeight
- Text {
- text: model.index
- }
- }
- }
- ListView {
- id: view
- model: 6
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- width: childrenRect.width
- height: 100
- // if you uncomment the following line
- // you get a binding loop as contentHeight depends on total height available
- // height: contentHeight
- delegate: demoDelegate
- onContentHeightChanged: {
- console.log("view's contentHeight changed to " + contentHeight)
- }
- }
- Component.onCompleted: {
- console.log("Screen construction completed, resizing listView to fit all the elements")
- view.height = view.contentHeight
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement