PyQt: How to set ComboBox current item Wihtout knowing Item's Index Number

pyqt, python, qcombobox, search

Solution

Use QComboBox.findText:

    index = myComboBox.findText('item02')

Problem

Created myComboBox with: ``` myComboBox = QtGui.QComboBox() ``` Populated it with three items: myItemsList = ['item01', 'item02', 'item03'] ``` for item in myItemsList: myComboBox.addItem(item) ``` Now I want to set a comboBox to a second item knowing only string value of the item: 'item02'. Let's assume I can't index myItemsList to find out what indexed position of an item with a value 'item02'. I want to set a myComboBox without using an item index number but its string value. Thanks in advance!

Original source