[Qt-interest] QComboBox list items
Robert Hairgrove
evorgriahr at hispeed.ch
Sun Jan 18 15:15:22 CET 2009
Thank you very much, this is just what I needed!
Tim Dewhirst wrote:
> Hello,
>
> Robert Hairgrove wrote:
>> Is there a built-in way to fetch all the string items in a combo box
>> or list view without iterating through all the indexes? For example, I
>> can call addItems() and pass a QStringList, and the list is populated.
>> I would like to be able to do the opposite (i.e., read all the items
>> at once by calling a function which returns a QStringList).
>>
>> Seems like it would make things a little more orthogonal if there were
>> such a function.
>
> Why not do it the other way around? QComboBox internally has a model but
> this can be replaced with a call to setModel(). Use a QStringListModel
> with the appropriate QStringList and you've fixed the problem!
>
> Hope that helps,
>
> Tim
> ----------------------------------------------------------------------
> dr. t. dewhirst
> director [w] www.bugless.co.uk
> bugless software development ltd.
>
> [a] algo business centre, glenearn road, perth, PH2 0NJ
More information about the Qt-interest-old
mailing list