EDIT: Btw, make sure you allocate widgets on stack if you set Qt::WA_DeleteOnClose attribute! Otherwise you'll get a crash due to double delete...
On the stack? I thought this allocates an object on the heap:
Qt Code:
  1. Object *example = new Object;
To copy to clipboard, switch view to plain text mode 

Anyways it works like you suggested, thank you!