[SailfishDevel] ListModel NOOB Error

Martin Jones martin.jones at jollamobile.com
Sun Mar 31 01:59:01 UTC 2013


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-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of Peter Jespersen [flywheel at 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


More information about the Devel mailing list