Almost... now I got it:

Qt Code:
  1. #if 0
  2. QWidget *frame = workspace->addWindow( widget );
  3. frame->setAttribute( Qt::WA_DeleteOnClose );
  4. #else
  5. workspace->addWindow( widget );
  6. widget->setAttribute( Qt::WA_DeleteOnClose );
  7. #endif
To copy to clipboard, switch view to plain text mode 

The first part of the code, is what you suggest. That does not work. The second one (on the else) does work.

The problem was th second parameter to setAttribute. THANKS!

(how do I change the thread name to "solved"?)