Creating events for combobox items
hey every1 this is my first post so im not sure if any1 will reply but here it goes. i have created a QCombobox and i have added 3 items to it. for each item i want it to signal a seperate event. is it possible to do this or should i use some other widget. i tried using highlighted() and activated() but they only seem to work for the combobox as a whole, is there anything i could use?
Re: Creating events for combobox items
Both of these signals carry the item index:
Quote:
void QComboBox::activated ( int index ) [signal]
This signal is sent when an item in the combobox is activated by the user. The item's index is given.
Re: Creating events for combobox items
I tried the function with the following piece of code:
Code:
connect(comboBox1, SIGNAL(activated(int 1)), this, SLOT(item1Chosen()));
but the debug says there is no such signal? do i have to set up the item's index manually?how would i go about doing that?
Re: Creating events for combobox items
Quote:
Originally Posted by confused
but the debug says there is no such signal?
Because you can't put parameter values in SIGNAL or SLOT macros.
Try this:
Code:
connect( comboBox1, SIGNAL( activated( int ) ),
this, SLOT( itemChosen( int ) ) );
Re: Creating events for combobox items
ok yeah i understand what ur trying to say now - i figured it out. thanks for the help