hi jacek,
Its working man. Thanks a lot. So, I have added the following step at line5:
Qt Code:
  1. clickPos=te->viewportToContents(clickPos);
To copy to clipboard, switch view to plain text mode 

regards,
Sarma.