[Qt-interest] Select index of comboBox with item Data (ID)
Malyushytsky, Alex
alex at wai.com
Wed Jun 30 23:30:35 CEST 2010
>> Qt has a select-by-ID feature in other widgets like for example in
QButtonGroup.
We are not talking about QButtonGroup.
QButtonGroup does not allow to associate any data with item.
Remove this feature from combobox and you have mostly identical interface.
Id for QButtonGroup is index for QComboBox.
>> This could be solved by adding functions like meantioned above and
adding information to the docs.
Why would not you put suggestion then?
It is not like I don't enjoy the discussion,
but it leads nowhere until you do it.
Regards,
Alex
-----Original Message-----
From: Matthias Pospiech [mailto:matthias.pospiech at gmx.de]
Sent: Wednesday, June 30, 2010 12:25 AM
To: Malyushytsky, Alex
Cc: Qt Interest
Subject: Re: [Qt-interest] Select index of comboBox with item Data (ID)
Malyushytsky, Alex schrieb:
>>> but would help developers avoid writing the same code every time they want to select an item with specific data.
>>>
>
> What you are going to save?
>
> Typing few characters:
> combo->setCurrentIndex( combo->findData(data, role, flags) );
> vs
> combo->selectItem( data, role, flags );
>
To me the number of character is not what is important for such a decision.
Qt has a select-by-ID feature in other widgets like for example in
QButtonGroup.
This is really helpful, because one can apply values from an enum and
set and select using these enum values.
A QButtonGroup however is not useful for an enum list with 5+ items. In
this case I switch to a
QComboBox for selection. However it is not obvious how to achieve the
same approach with a QComboBox.
This could be solved by adding functions like meantioned above and
adding information to the docs.
Matthias
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list