PDA

View Full Version : Some Signal Ignore



nicolas1
30th December 2008, 13:43
Hello,

I need to block some signals (QPushButton pressed) for some time.

For example, dialog button was pressed, some routine started but from time to time event queue is being processed, so it is possible to press some other button. And its effect will be not good.

spirit
30th December 2008, 13:57
the first variant


....
bool isBlocked = myButton->blockSignals(this);
//routines
myButton->blockSignals(isBlocked);
....

the second variant


...
myObject->disconnect(myReceiver);
...

see more information disconnect (http://doc.trolltech.com/4.4/qobject.html#disconnect)

wysota
31st December 2008, 02:07
I'd suggest simply disabling the buttons you don't wish pressed with QWidget::enabled property. This is the only (proper) visible way to tell the user - "you can't push this button now but it will be available later on". If you block or disconnect the signal, the user will be able to push the button - it will simply do nothing which doesn't seem very correct.