If you created it on stack, it'll be removed when the scope where it was declared ends. If you created it on heap, you should pass a pointer to a parent object (any QObject descendant or QObject itself), then it'll get destroyed when that parent object gets destroyed.