QComboBox *myComboBox = new QComboBox(parent); myComboBox->setObjectName("myComboBox");
QComboBox *myComboBox = parent->findChildIn this example, the parent widget is searched for a QComboBox object with the name "myComboBox" using the findChild() function. If the object is found, two new items ("Option 1" and "Option 2") are added to the drop-down menu using the addItem() function. Package library: Qt.("myComboBox"); if (myComboBox) { myComboBox->addItem("Option 1"); myComboBox->addItem("Option 2"); }