Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import QtQuick.Controls 1.1
- import QtQuick.Layouts 1.1
- Rectangle {
- id: rectangle1
- function random_text( itemno ) {
- var i;
- var str;
- str = "<b>item(" + itemno + ")</b><br/>" ;
- var n = Math.round(100.0 * Math.random()) ;
- for ( i=0 ; i < n ; i++ ) {
- str = str + ' xyz abc ' ;
- if (Math.random() < .2 ) {
- str += "EOL<br/>";
- }
- }
- return str;
- }
- width: 400
- height: 500
- ListView {
- id: flickable
- anchors.fill: parent
- model: 10
- spacing: 20
- delegate:
- Rectangle {
- radius: 5
- border.color: "brown"
- border.width: 2
- color: "yellow"
- width: parent.width
- height: mytext.contentHeight * 1.1
- Text {
- wrapMode : Text.WordWrap
- width: parent.width * 0.95
- font.pointSize: 12
- id: mytext
- text: random_text(modelData)
- }
- }
- onFlickEnded: {
- console.log("Flick has ended");
- console.log("flickable height is " + flickable.height )
- console.log("flickable contentheight is " + flickable.contentHeight )
- console.log("flickable flickable.visibleArea.heightRatio is " + flickable.visibleArea.heightRatio)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement