2

I need to put a ListView ( coded in QML) into a Row, but in this case only first Row of the ListView is displayed . Some idea why ? Here is my example :

 import QtQuick 2.0
 import Ubuntu.Components 0.1

 Page {
     id: test


      Column {
          spacing: units.gu(1)
          id: pageLayout
          anchors {
              margins: units.gu(2)
              fill: parent
          }


          Row {
              id: listarea
              spacing: units.gu(1)

              ListModel {
                  id: fruitModel
                  ListElement {
                      name: "Apple"
                      cost: 2.45
                  }
                  ListElement {
                      name: "Orange"
                      cost: 3.25
                  }
                  ListElement {
                      name: "Banana"
                      cost: 1.95
                  }
              }

             ListView {
                 anchors.fill: parent
                 model: fruitModel
                 delegate: Row {
                     Text { text: "Fruit: " + name }
                     Text { text: "Cost: $" + cost }
                 }
             }
          }
      }
 }
2

Set anchors.fill: parent on your Row

2
  • If I have in first row buttons and in second row the ListView, they are overwriten. Any suggestions what's wrong ?
    – user262898
    Mar 29 '14 at 23:53
  • If you are going to have more than the ListView, you'll need to give it an explicit height, otherwise the Column won't know where to put the others
    – mhall119
    Mar 31 '14 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.