PDA

View Full Version : disabling the signal event



aj2903
20th February 2010, 14:35
hello.....
can we disable the SIGNAL for some specific time & then enable it in real time ?

For Eg:
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(clicked()));

I want to disable the clickced SIGNAL for specific time & then re-eanble it;
When the SIGNAL is disabled, if the user clicks on the button no SIGNAL should be called.

nish
20th February 2010, 14:50
take a look at QObject::disconnect()

aj2903
22nd February 2010, 06:44
i want to disable SIGNAL((valueChanged (int))) of QSpinbox,

but when i tried to use the code:



ui->spinBox->disable()


it is not showing option for (valueChanged (int)), it is applicable for tthis SIGNAL

boudie
22nd February 2010, 08:17
As MrD. suggested, you have to do this:
disconnect(ui->spinBox, SIGNAL(valueChanged (int)), 0, 0);

You may read the QObject Class Reference for more info about this.

navi1084
22nd February 2010, 08:58
If you want to block all signals of particular control use
blockSignals() function.

basslo
13th July 2012, 12:15
If you want to block all signals of particular control use
blockSignals() function.

thanks navi, it s exactly what i wanted. :)

sonulohani
13th July 2012, 12:26
But you can also perform your task through disconnect also.