QList<QString> list; list << "1" << "2" << "3" << "4" << "5"; ui->comboBox->addItems(list); QString number = "3"; 

How to do so, if the number 3 was found in the comboBox list comboBox then the number 3 is selected in the same list as the currentItem at the same position as the number 3 in the comboBox ? Ie by pressing the comboBox selection of the number 3 is in the 3rd position.

Closed due to the fact that the essence of the question is not clear to the participants free_ze , tutankhamun , aleksandr barakin , cheops , user207618 12 Sep '16 at 15:51 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Please make it clearer what you want to achieve. - Cerbo

2 answers 2

int QComboBox :: findText + setCurrentIndex if found

      ui->comboBox->setCurrentIndex(number); 
    • If the full example: ui-> comboBox-> setCurrentIndex (ui-> comboBox.findText ("3")); - gil9red