<div class=”content”>
Hello Guys,
</div>
maybe i get here a solution of my problem.
<div class=”content”>
i´ve tried to put my own backend c++ code in a QML model, it´s from the v-play messenger example.
i write a new class with this code:
class DataObject : public QObject
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QString detailText READ detailText WRITE setDetailText NOTIFY detailTextChanged)
...
i add then with:
QList dataList;
dataList.append(new DataObject(chat->kon[i]->getname(), QVariant(ia).toString()));
a new QList.
so far so good.
Now i add in the main.cpp with:
engine.rootContext()->setContextProperty(“modelContact”, QVariant::fromValue(cont->dataList));
a modelContact property.
so in the example code it´s in the qml code the following area that i want to change:
// Model should be loaded from your messaging backend
// model: [
// { text: "Tom McEloy", detailText: "Sorry for the late reply ...", image: Qt.resolvedUrl("../../assets/portrait0.jpg") },
// { text: "Leah Douglas", detailText: "Hahaha :D", image: Qt.resolvedUrl("../../assets/portrait1.jpg") }
// ]
so like the comment i want to load the model from the backend, so i try:
model: modelContact
but i get no text or detailtext, where is the problem?
</div>