QML question
Joakim Bygdell
j.bygdell at gmail.com
Wed Apr 27 10:15:34 PDT 2016
> On 27 Apr 2016, at 18:55, Tomaz Canabrava <tcanabrava at kde.org> wrote:
>
> Please, please:
>
> don't add more stuff to the QMLManager, it's a huge beast already :)
> crete something like this:
>
> Q_INVOKABLE QStringListModel : DiveObjectHelper::buddies() {
> static QStringListModel buddies = new QStringListModel();
> QStringList temp;
> for_each_dive (i, d) {
> temp << d->buddy;
> }
> temp.removeDuplicates();
> buddies.setStringList(temp);
> qDebug() << temp;
> return buddies;
> }
>
> What can be happening is that a QStringList will not tell QML that it changed, and thus, it wont update it's contents.
> a Model will.
Fully understandable.
But why do I get data in my combobox if I do this: buddies << “foo” << “bar”
and not this: buddies << d->buddy.
If I add
buddies << “foo” << “bar”;
before the return statement, the combobox will have two entries, “foo” and “bar".
If i replace the combobox with a label where the text is a QString generated by joining the QStringList
I get all buddies displayed on one line. “Buddy A, Buddy B, foo, bar"
>
>
/Jocke
More information about the subsurface
mailing list