PDA

View Full Version : access to combobox number



uz_qt
14th October 2013, 12:33
Hello,

I have 3 QComboBoxes:

Combo 0:
Combo 1:
Combo 2:

I have used a for loop to add them to the layout. Each comboBox has 2 items added to it. Using the connect function, when the index of the item is changed, then I call the slot function.

So far its clear. But, I would like to have access to the Combo box number as well in the slot function.

For example, when I change the index to 1 in Combo 2, then along with the index number = 1, how can I have access to the combobox number = 2 as well in the slot function?

Please guide.

Lesiok
14th October 2013, 14:25
Read about QObject::sender or QSignalMapper.

anda_skoa
14th October 2013, 17:35
Or three slots that call a common private method with the combo box number as and additional argument

Cheers,
_

uz_qt
14th October 2013, 18:17
thanks guys for your inputs.

I have created a QComboBox subclass and appended them using QVector<>. It works as desired now.

Following document was helpful too! (for those who have similar problems)
http://doc.qt.digia.com/qq/qq10-signalmapper.html

Cheers! :-)