Dear Mike,

WStringListModel doesn't support extra data.
A better way to implement this,
is by using WAbstractItemModel's setData() and data(),
where you assign the id as data with a UserRole.

WStandardItemModel provides support for extra data,
and an example can be found at wt/examples
/treeview-dragdrop/TreeViewDragDrop.C
populateFiles() populates the model with WStandardItems containing data
within the UserRole,
and folderChanged() extracts data within the UserRole from the model.

Kind regards,

Pieter

On 4 March 2010 11:04, Mike Teehan <[email protected]> wrote:

> Hello everyone,
> I just have a simple question here: is it okay to add strings to a
> WStringListModel with non-contiguous rows?
>
> Example: Mapping usernames back to dbo::id's in a WComboBox.  I use the
> id() as the row when i add the username to the WStringListModel used by
> said combobox, the idea being that activated() will then emit the row
> number and give me the id of the newly selected user, making db lookups
> super easy.
>
> Would you consider this a good practice, or should I not be doing this?
>
> I'm getting stl_uninitialized.h errors in my frame stack that I've never
> seen
> before (maybe from the empty rows?) to go with my newest segfault.
>
> Thanks,
> Mike
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to