C++ (Qt)qint32 width = 0;QFontMetrics fm(ui->comboBox->font());for(int i = 0; i < ui->comboBox->count(); ++i) width = qMax(fm.width(ui->comboBox->itemText(i)), width);ui->comboBox->view()->setMinimumWidth(width + 10)