Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm developing an app for ubuntu touch and I have tabs there. In one of them there is a list.

if I have this it don't show me any of items.

        Tab {
        objectName: "Tab3"

        title: i18n.tr("List")

        page: Page {
            ListView {

            ListItem.Subtitled {
                    text: "Item One"
                    subText: "21 m \t North"
                }
            ListItem.Subtitled {
                    text: "2nd item"
                    subText: "2.61 km \t South"
                }
            }
        }
    }

Where is the mistake? Thanks very much.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

ListViews get data from a ListModel, you don't directly add ListItems to them. See http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-listview.html#model-prop for more information about that.

A ListItem.* is used on the delegate property of your ListView, and will be used as kind of a template component, a new copy will be made for each item in your ListModel

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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