positive_4_life
14th October 2011, 15:21
I want to prevent a connection between a ui object signal and a slot from occurring if there is already an existing connection.
I can't use Qt::UniqueConnection due to only being able to use 4.5.x, and I can't use QObject::receivers() as a condition in an if statement because it is a protected function.
//doesn't work as protected
if(ui.comboBox->receivers(SIGNAL(currentIndexChanged(int)))
QObject::connect(ui.comboBox,SIGNAL(currentIndexCh anged(int)),this,SLOT(comboBoxchanged(int)))
Any ideas how I could I would be able to check for duplicate connections for these ui objects?
I can't use Qt::UniqueConnection due to only being able to use 4.5.x, and I can't use QObject::receivers() as a condition in an if statement because it is a protected function.
//doesn't work as protected
if(ui.comboBox->receivers(SIGNAL(currentIndexChanged(int)))
QObject::connect(ui.comboBox,SIGNAL(currentIndexCh anged(int)),this,SLOT(comboBoxchanged(int)))
Any ideas how I could I would be able to check for duplicate connections for these ui objects?