1 QComboBox *editor = new QComboBox(this); 2 comboBox->addItems(QStringList()<<tr("Always")<<tr("Never")<<tr("Motion detection")<<tr("Timer recording")); 3 QVariant v(0); 4 // 序号为2的选项(第三个)不可选 5 comboBox->setItemData(2, v, Qt::UserRole - 1);