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);

 

相关文章:

  • 2021-12-04
  • 2022-01-03
  • 2021-06-17
  • 2021-11-18
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案