Hi,
I would like to add items to my combobox during starting up my application. And after adding all my items I would like to change the current index to my default. Sadly on the GUI the combox is blank if my program starts up. If I click on the combobox I will see the added items. Do I have to call some update method?
What I’m wondering too is if don’t call setCurrentIndex() method. Then the combox will not be blank and index 0 is visible.
Thanks in advance for your help.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
for(UINT8 i = 0; i < ( sizeof(myList)/sizeof(myList[0]) ); i++)
{
ui->comboBox->addItem( myList[i] );
}
connect(ui->comboBox, SIGNAL( currentIndexChanged(int) ), this, SLOT( mySlot(int) ) );
ui->comboBox->insertSeparator(4);
emit ui->comboBox->setCurrentIndex(4);
}
↧