I am doing something in the QTextEdit. I write a slot for the QClipboard::changed() signal. In the slot, how can I tell if the text in the clipboard is from my app (not from other apps outside)?
My solution is to compare the text in the clipboard and the selected text:
mimeData->text() == textCursor()->selectedText()
However, I found that when I selected multiple lines and copied it. The selectedText() handle the \n as 0 while the mimeData handle it as \n (that is 10). So mimeData->text() != textCursor()->selectedText().
By the way, what does QClipboard::ownsClipboard() mean? Is it what I am looking for?
Any help? Thanks!
According to the documentation:
So it is what you are looking for.
slot:
Transcribing from the documentation of
selectedText()