Extracting text of the selected QComboBox item is well known, but how do I get the text in a QComboBox for an arbitrary index item (not necessarily the one selected)?
Use itemText() method to do this. Just set needed index.
As Marek R pointed, you can get model and get data from this model, but it will be helpful for you when you want to get something more than text( for example get image with Qt::DecorationRole or font with Qt::FontRole)
http://qt-project.org/doc/qt-4.8/qcombobox.html#itemText
http://qt-project.org/doc/qt-4.8/qcombobox.html#model
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With