http://doc.trolltech.com/4.4/qlistwidget.html
The items are always numbered from 0
Is it possible to add a custom number/string rather than the ones provided by default ?
Something similar to the select statement in HTML ?
![]()
http://doc.trolltech.com/4.4/qlistwidget.html
The items are always numbered from 0
Is it possible to add a custom number/string rather than the ones provided by default ?
Something similar to the select statement in HTML ?
![]()
Do you mean that you would like to pass something different than 0-based index to QListWidget::item()?
<select>
<option value="A001">Alanka</option>
..
I want do something that is similar to a select option in html. It allows the programmer to specify their own index values.
this too applies for qcombobox.
It only allows int index starting from 0.
Is it possible ?
You can use two QMaps to translate indices to keys and vice versa.
I will have to create a seperate map that links the model index values with ids comings from database ?
The combobox i want to use is linked with a db. with one tables ids, name
I want to show the name in the combo box and the ids as the index value.
i will have to create a seperate map that links the ids with the int. index of combo box and call the function does that everytime the underlying model changes ?
You can use QComboBox::setItemData() to make a mapping. I'm not sure what does it have to do with QListWidget...
Bookmarks