PDA

View Full Version : QDateEdit: Don't emit dateChanged when calling setDate



niko
8th July 2006, 16:41
I have a QDateEdit-dateChanged-signal connected to a model-class.
When i do change the date in the model-class from outside (open a file in my application) i call QDateEdit::setDate.
Which then emits the dateCahnged signal and calls the slot in my model-class - setting the date AGAIN (which the model-class just changed!)

Can i avoid this? For examle a QDateEdit::setDateWithoutSignals; or a possibility to temporaly disable the signals?

....or is the common way to just ignore this?


thanks,
niko

jacek
8th July 2006, 17:03
Can i avoid this? For examle a QDateEdit::setDateWithoutSignals; or a possibility to temporaly disable the signals?
You can use QObject::blockSignals() or just don't invoke setDate() if the date you receive is equal to the date set in QDateEdit.

niko
8th July 2006, 17:16
blockSignals is exaclty waht i was looking for, much thanks!