Now, this is a super quick tip, as it’s really a no-brainer. The explanation (if you need one) is that a QApplication has a global instance of the clipboard, which can be accessed by simply getting a pointer to it. So lets just get to the code!
QClipboard *p_Clipboard = QApplication::clipboard(); p_Clipboard->setText(textForClipboard);
And viola! Just like that, your text should now be on the system clipboard. Happy coding!