connect(m_pComboBoxDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(sltComboBoxDeviceCurrentTextChanged(int)));

void VideoGrid::updateListWidgetData()
{
  //就像给信号量加锁一样:
  m_pComboBoxDevice->blockSignals(true);   //锁上。addItem更改值时不触发currentIndexChanged信号
  m_pComboBoxDevice->addItem(list[0]);
  m_pComboBoxDevice->blockSignals(false);   //解锁
}

void VideoGrid::sltComboBoxDeviceCurrentTextChanged(int index)
{
    updateListWidgetData();
}

 

相关文章:

  • 2022-12-23
  • 2021-09-15
  • 2021-11-18
  • 2021-05-08
  • 2021-06-30
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-11
  • 2021-11-13
  • 2021-06-12
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案