[Qt-interest] [QML] - Problem with Flickable and Flow

BOUCARD Olivier boucard_olivier at yahoo.fr
Tue Aug 30 17:05:21 CEST 2011


Hi,

I have a small piece QML code that I cannot make it work.
Basically  its a Flickable with a Flow. The Flow is filled with a Repeater of simple Rectangles.
Here the code:
Flickable {
  id: galleryViewport
  anchors.fill: parent
  anchors.margins: 16
  clip: true
  contentHeight: gallery.height

  Flow {
    id: gallery
    anchors.fill: parent
    spacing: 24
    clip: true
    
    Repeater {
      model: 300
      Rectangle {
        width: 150
        height: 84
        color: "lightgreen"
        
        Text {
          text: index
          font.pointSize: 30
          anchors.centerIn: parent
        }
      }
    }
  }
}

Text {
  id: test1
  height: 24
  width: 300
  text: "Test: " + gallery.height
}

The problem is when I set "contentHeight: gallery.height" gallery.height value is 0 (as shown by Text test1) so Flickable always return to the origin and theheightRatio is Infinity and I cannot make a scrollbar.
If I comment this line gallery.height value is OK but the Flickable does not work.

Someone could explain me this behavior, please?

I have Qt 4.8b1 under Mac OS X Lion.

Thank you.

Olivier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110830/fdb1d717/attachment.html 


More information about the Qt-interest-old mailing list