PDA

View Full Version : Qt Deletelater



bunjee
8th January 2008, 16:08
Hey there,

One of my widget is emiting a "deleteMe" signal on the mouse release event.

I've come up to this to avoid the "do not delete an object in his event" Qt warning,


//================================================== ===========================
//================================================== ===========================

/* virtual */ void ZeContactWidget::mouseReleaseEvent(QMouseEvent * event)
{
QTimer::singleShot(1, this, SLOT(onEmitClick()));
}

but I'm not sure that the proper way to do it, even if not crashing :S.
Do I have to call deleteLater() to delete that widget ?

Thanks.

marcel
8th January 2008, 16:56
Yes, it is best to call deleteLater, if you have no other choices.

Regards

bunjee
8th January 2008, 16:58
And what could other choices be ?