QML question

Tomaz Canabrava tcanabrava at kde.org
Wed Apr 27 10:22:24 PDT 2016


On Wed, Apr 27, 2016 at 2:15 PM, Joakim Bygdell <j.bygdell at gmail.com> wrote:

>
> > 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"
>

I have *no* idea, really.
can you create a branch where I can try this?
currently I'm in the middle of a subsurface refactor for 5.0 (
tcanabrava/subsurface:new_ui )
with almost 100 commits, I need to speed things there too.



>
>
>
>
> >
> >
>
> /Jocke
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160427/ac11b9e5/attachment.html>


More information about the subsurface mailing list