In my application I want generate random numbers or strings with a text in front of it. It is important for me that the text won't appear in my window, but instead gets copied to the clipboard.
int randomnumber = rand() % 46 + 1;
QClipboard *cb = QApplication::clipboard();
cb->setText("Just a test text. And here we have a placeholder! %i", randomnumber);
QClipboard works fine with plain text (in this example "Just a test text. And here we have a placeholder!"). But I also want to copy placeholders for random numbers so that the copied text looks like this:
Just a test text. And here we have a placeholder! 42
Sadly I get the error message: invalid conversion from 'int' to 'QClipboard::Mode'
Is it possible to copy text, placeholders and so on to the clipboard and not just plain text?