one more, in this method
Qt Code:
  1. void MainWindow::createDialog(){
  2. Dialog *d = new Dialog;
  3. d->exec();
  4. }
To copy to clipboard, switch view to plain text mode 
you should set parent or delete dialog manually.