-
-
Save celeron55/be5da1329ccc7fe72bed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Entity : public QObject | |
{ | |
Q_OBJECT | |
Q_PROPERTY(QVariantMap components READ components NOTIFY componentsChanged) | |
Q_PROPERTY(QString testname READ testname) | |
QVariantMap m_components; | |
public: | |
QVariantMap& components(){ return m_components; } | |
QString testname(){ return "Lörs Lärä"; } | |
signals: | |
void componentsChanged(); | |
}; | |
... | |
Q_PROPERTY(QList<QObject*> entities READ entities NOTIFY entitiesChanged) | |
... | |
import QtQuick 2.0 | |
import Sailfish.Silica 1.0 | |
import MetacraneClient 1.0 | |
Page { | |
id: page | |
property string crane_name: "Unknown" | |
SilicaListView { | |
id: listView | |
anchors.fill: parent | |
header: PageHeader { | |
title: "\""+crane_name+"\" | Metacrane" | |
} | |
model: MetacraneClient.entities | |
delegate: BackgroundItem { | |
id: delegate | |
Label { | |
x: Theme.paddingLarge | |
text: "Item "+index | |
//text: components.description.text | |
//text: testname | |
anchors.verticalCenter: parent.verticalCenter | |
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor | |
} | |
MouseArea { | |
anchors.fill: parent | |
onClicked: { | |
console.log("Clicked " + index) | |
console.log("delegate", delegate) | |
console.log("model", model) | |
console.log("model.testname", model.testname) | |
} | |
} | |
} | |
VerticalScrollDecorator {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment