schall_l
3rd August 2009, 16:07
Hi,
I have a Dialog implementing 2 QListWidgets.
The lists are filled before the dialog is executed, and in order to make it convivial for the user I am setting the lists whith strings that are user friendly f.e.:
0x1234/4660 - Engine 1 speed indication
0x1333/4915 - Engine 1 temperature
...
...
The user can then drag and drop between the 2 lists.
When the widget is closed I would like to get what is in both lists.
I am wondering what would be the best way to associate userData to each item placed in the lists (somehow like what is possible with QComboBox::addItem(const QString & text, const QVariant & userData = QVariant()).
In such a case, the post treatment would be easier for me. I would then just itterate through the lists in order to get the userDatas composing each list instead of the user friendly string.
I have a Dialog implementing 2 QListWidgets.
The lists are filled before the dialog is executed, and in order to make it convivial for the user I am setting the lists whith strings that are user friendly f.e.:
0x1234/4660 - Engine 1 speed indication
0x1333/4915 - Engine 1 temperature
...
...
The user can then drag and drop between the 2 lists.
When the widget is closed I would like to get what is in both lists.
I am wondering what would be the best way to associate userData to each item placed in the lists (somehow like what is possible with QComboBox::addItem(const QString & text, const QVariant & userData = QVariant()).
In such a case, the post treatment would be easier for me. I would then just itterate through the lists in order to get the userDatas composing each list instead of the user friendly string.