Hi,

The error is not the same one that I see when I try this, but there is 
certainly an error there.  ListModel's elements are named "ListElement", not 
"ListItem".

A few other issues:
- PullDownMenu should be a child of the SilicaListView.
- contentHeight is not a property of Page. The PageStack will automatically 
size the Page for you.
- the listview should probably be sized via 'anchors.fill: parent'

Best Regards,
Martin.


________________________________________
From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of Peter Jespersen [flywh...@illogical.dk]
Sent: 31 March 2013 11: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
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to