Replacing
Qt Code:
  1. painter.beginNativePainting();
  2. painter.endNativePainting();
To copy to clipboard, switch view to plain text mode 
through
Qt Code:
  1. painter.begin(this);
  2. painter.end();
To copy to clipboard, switch view to plain text mode 
fixed it for me!