try something like this
Qt Code:
  1. ...
  2. img = QImage::fromData(data,"PNG");//the second param is format name
  3. ...
To copy to clipboard, switch view to plain text mode