PDA

View Full Version : QTimer lifetime



milend
6th August 2008, 20:09
Hi all,

I've got a single-shot QTimer which is allocated like:

QTimer* timer = new QTimer(this);
timer->setInterval(...);
timer->setSingleShot(true);
timer->start();

I wonder whether the timer gets dealloced when it fires or when the current object gets deallocated. The reason I am asking is because I allocate many of these timers throughout the lifetime of the object.

Thanks,
M

jacek
6th August 2008, 20:33
No, it doesn't. But you can connect it to its own deleteLater() to make it self destruct safely.