[Interest] Modify object list in qml

Oleg Evseev ev.mipt at gmail.com
Wed Nov 29 20:41:43 CET 2017


Hi all,

I would like to push an empty object in front of objects list model of
ComboBox.
I can do this in c++:

QList<QObject*> SomeClass::getList() {
    QList<QObject*> list = db.getList();
    list.push_front(Q_NULLPTR);
    return list;
}

then set it as model for ComboBox:

    model: SomeClass.getList()

And it works, I then can check modelData for null in delegate.

But I'm interesting if there is any way I could do it in qml, something
like:

  model: [0, (or undifined), DB.getList()]
or
  model: {0, (or undifined), DB.getList()}

or push empty object in front of list in Component.onCompleted?

Thanks in advance for help!

--
With regards, Oleg.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171129/4f530dc0/attachment.html>


More information about the Interest mailing list