向comboBox部件里添加元素

QStringList string;
    string<<""<<"";
    ui->comboBox->addItems(string);

个人理解这也是Qt的MVC模型的体现,QStringList是装载数据的model,当然comboBox就是view

怎么获取comboBox里的数据呢,可以这样

ui->textEdit->setText(string[ui->comboBox->currentIndex()]);

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案