[SOLVED] QSignalMapper and QComboBox
depecheSoul last edited by
Hello. In the process of learning QSignalMapper, I wrote a some code out of my head, that has QComboBox, and QLabel. I have made a program that changes text in QLabel, when QComboBox is activated. The problem is that I only get the output of 4. QComboBox has values from 0 to 4.
I think the problem is within this line of code:
because I didint set elements but only QComboBox. Is that any way that I can set signal mapping for individual values inside QComboBox.
QSignalMapper is used to combine multiple signals from different widgets into one signal, for example if you want to change the text of a label from the values of multiple combo boxes.
If you just want to set the label to the value of a combo box use the currentIndexChanged signal instead.
connect(comboBox, SIGNAL(currentIndexChanged(QString)), label, SLOT(setText(QString)));
In addition to the documentation you might read "this article":http://doc.trolltech.com/qq/qq10-signalmapper.html featuring the purpose and usage of QSignalMapper.