[Kde-bindings] QComboBox use

Arno Rehn arno at arnorehn.de
Thu Jan 31 20:29:33 UTC 2008


Hi,

Am Donnerstag 31 Januar 2008 10:03:16 schrieb Miquel:
> Hi there
>
> I don't know if this is a good place to ask this but i'll do because I
> am using the qtruby binding.
>
> I'm developing a little application for home expenses (open source of
> course) and I'm using QComboBox widgets. The thing is that I have
> worked with other graphical toolkits and one of them allows the
> possibility to select the items using its index, its text or its value
> (when an item is added exists the possibility to define the shown text
> an an associated value for it).
>
> For example, you have a SQL Table which contains the european countries
> with two columns, the first one is the id (integer) which is used as
> Primary Key and the second one the country name (varchar). If you want
> to show the data using a ComboBox, the text would be the country name
> and the value would be the id.
>
> Is there something similar using QComboBox?
You can select an item with it's index, see QComboBox::setCurrentIndex. In 
Ruby this should be as simple as 'mycombo.currentIndex = index'.
Just look that stuff up in the Qt documentation, it's quite useful ;)

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list