QML question
Joakim Bygdell
j.bygdell at gmail.com
Wed Apr 27 09:46:04 PDT 2016
> On 27 Apr 2016, at 18:27, Thiago Macieira <thiago at macieira.org> wrote:
>
> On quarta-feira, 27 de abril de 2016 17:40:53 PDT Joakim Bygdell wrote:
>> Thomas or Thiago can you explain what’s going on here?
>>
>> I have a combobox that gets populated from a QStringList.
>>
>> If I generate the QStringList on the C++ side like so,
>> list << “foo” << “bar << “baz"
>> my combobox contains 3 elements as expected.
>>
>> If I populate the QStringList with data from the dive struct,
>> list << dive.buddy << dive.divemaster
>> the combobox is empty.
>>
>> In the later example the QStringList contains the expected data as I can
>> join the QStringList into a QString that displays correctly on the QML
>> side.
>
> The source of the data is not the issue here. That's a red herring. The
> problem is something else.
>
> 1) are you sure dive.buddy and dive.divemasters are non-empty strings?
Yes as I can concatenate the list to a single string that is displayed on
the QML side with the correct content.
>
> 2) is there anything special about the content of those strings?
Nope, just normal names.
>
> 3) can you show the code after that?
QML side:
Combobox {
id: buddyBox
model: buddyList
}
C++ side:
QStringList QMLManger::buddyList() const
{
QStringList buddies;
struct dive *d;
int i = 0;
for_each_dive (i, d) {
buddies << d->buddy;
}
buddies.removeDuplicates();
return buddies;
}
>
> --
> Thiago Macieira - thiago (AT) macieira.info <http://macieira.info/> - thiago (AT) kde.org <http://kde.org/>
> Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org <mailto:subsurface at subsurface-divelog.org>
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface <http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
/Jocke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160427/3027da38/attachment-0001.html>
More information about the subsurface
mailing list