Thank you very much, both of you - the twisted world of Qt-Quick seems a tad more clear today. Earlier this week I managed to punch a hole in the barrier between QML and C++ classes, perhaps I'm really getting somewhere this time.
Well - after a couple of hours - playing with QML and feeling my way, with your advice at the back of me old head - I got something that seems to work in the direction, that I wanted. --------------------------------------------------- import QtQuick 1.1 import Sailfish.Silica 1.0 Page { id: secondPage SilicaFlickable { anchors.fill: parent ListModel { id: fruitmodel ListElement { fruit: "jackfruit" } ListElement { fruit: "orange" } ListElement { fruit: "lemon" } ListElement { fruit: "lychee" } ListElement { fruit: "apricots" } } Component { id:myDelegate Text { text: fruit font.pixelSize: 30 color: "white" MouseArea { anchors.fill: parent onClicked: { console.log("Clicked: " + fruit) } } } } SilicaListView { PullDownMenu { MenuItem { text: "Show Page 1" onClicked: pageStack.push(Qt.resolvedUrl("FirstPage.qml")) } MenuItem { text: "Show Page 3" onClicked: pageStack.push(Qt.resolvedUrl("ThirdPage.qml")) } } anchors.fill: parent anchors.topMargin: parent.height / 8 anchors.margins: parent.width / 10 model:fruitmodel delegate:myDelegate spacing: 5 } } } --------------------------------------------------- On Sun, 31 Mar 2013 01:25:41 +0000 mfaro-tus...@live.com <mfaro-tus...@live.com> wrote: > Try doing list model separate else where . > > > > Eg. > > > > ListModel{ > > Id: listModel > > ListElement{ > > //Fill the list info here > > } > > ListElement{ > > //Repeat for every element > > } > > > > Then > > Change the List view to be like this > > > > SilicaListView { > width: 480; height: 800 > model: ListModel > > Label: model.fieldName > > } > > > > Sorry for the poor reply, away from my pc atm to double check it > will work. > > ------ Original message ------ > From: Peter Jespersen > Date: 31/03/2013 12:08 > To: SailfishOS Developer Mailinglist; > Subject:[SailfishDevel] ListModel NOOB Error > > Hello I'm new to this one and I'm having a bit of a problem. > I am using the Sailfish Application template of the Sailfish Creator, > which creates a cover page and two QML pages + a main.qml. > > I have extended the second page, trying to get some Listview going. > Well - actually I have copied most from your > sailfishsilica-silicalistview web page > (https://sailfishos.org/sailfish-silica/qml-sailfishsilica-silicalistview.html#details) > > Resulting in the following : > > ----------------------------------------------------------------------------------- > import QtQuick 1.1 > import Sailfish.Silica 1.0 > > > Page { > id: page > PullDownMenu { > MenuItem { > text: "Show Page 1" > onClicked: pageStack.push(Qt.resolvedUrl("FirstPage.qml")) > } > MenuItem { > text: "Show Page 3" > onClicked: pageStack.push(Qt.resolvedUrl("ThirdPage.qml")) > } > } > > contentHeight: childrenRect.height > > SilicaListView { > width: 480; height: 800 > model: ListModel { > ListItem { fruit: "jackfruit" } > ListItem { fruit: "orange" } > ListItem { fruit: "lemon" } > ListItem { fruit: "lychee" } > ListItem { fruit: "apricots" } > } > delegate: Item { > width: ListView.view.width > height: theme.standardItemHeight > > Label { text: fruit } > } > } > } > ----------------------------------------------------------------------------------- > > So far so good - but when building it - I get the following : > > > Error: Error while loading page: > file:///opt/sdk/share/myfirstapp/pages/SecondPage.qml:20 ListModel is > not a type > > My first reaction is WTF ??? > It seems like I'm unable to spot the error > Anybody able to spot the problem ? > > Thanks in advance :o) > > --- > > Mange hilsner/Regards ... > Peter Jespersen > Linux User #221493 > > “My software never has bugs. It just develops random features ...” > _______________________________________________ > SailfishOS.org Devel mailing list --- Mange hilsner ... Peter Jespersen Linux User #221493 “My software never has bugs. It just develops random features ...” _______________________________________________ SailfishOS.org Devel mailing list