QComboBox的currentIndexChanged信号死循环问题
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(); }
浙公网安备 33010602011771号