tl;dr:How can I use a list of strings defined in ECL as a ListView model in QML in Qt 5.6?

===

So I'm really not familiar with Qt, but since it is the GUI toolkit for Sailfish phones I have to use it.

I'm trying to make a list of strings in ECL available as model to a ListView which has been defined in QML. I've been looking at examples, specifically this one: https://gitlab.com/eql/EQL5/-/blob/master/examples/M-modules/quick/item-model/list-model.lisp but I cannot use it directly because of some constraints in my environment and I also cannot wrap my head about how to solve it.

This is the ListView in QML:

    SilicaListView {
        anchors.fill: parent
        //model: ListModel { id: listModel }
        model: 100

        header: PageHeader { title: "Messages" }

        delegate: BackgroundItem {
            id: delegate

            Label {
                text: "Item " + index
            }

            onClicked: console.log("Clicked " + index)
        }

        ...

And this is what I have in Lisp so far:

    ;;; Model
    ;;;
;;; https://gitlab.com/eql/EQL5/-/blob/master/examples/M-modules/quick/item-model/list-model.lisp

    (defun set-my-model ()
      (qlet ((data (qvariant-from-value *pushover-messages*
                                                "QStringList")))
        (|setContextProperty| (|rootContext| qml:*quick-view*) "myModel"
             data)))

Taken straight from the example. However, I'm not sure what to do with the `qml:*quick-view*`

The problem is my constraints:

- I cannot start Qt from Lisp like in the example. There's a C++ initializer which start s up all the Sailfish OS stuff and EQL. So far I'm doing `Lisp.call`s from QML which works well enough. (Also see Renaud's template which I based all this on: https://redmine.casenave.fr/projects/eql5-sfos/repository/44/revisions/master/entry/src/eql5-sfos.cc )

- Sailfish OS only supports Qt 5.6

Thanks,
Erik

Reply via email to