Hi all,
I would like to copy some files in to Windows clipboard (if it's the clipboard...) like
copying text with QClipboard. So then I can paste using normal Windows "Paste" command.
Is that possible?
thanks in advance
Hi all,
I would like to copy some files in to Windows clipboard (if it's the clipboard...) like
copying text with QClipboard. So then I can paste using normal Windows "Paste" command.
Is that possible?
thanks in advance
Yes, just use an appropriate mime-type for your data. As far as I remember file paths can be encoded using text/url-list mime. But it's more likely that you want to store the object and not the file path itself...
Yes, this is my case. I want to copy the entire file content like when someone does Copy and Paste from the file system. Can I do that from a QT Application?
thanks
I already answered your question.
This might help you
thanks,
I thought there was a way using QT Clipboard, in a way that would be multiplatform.
I found
void QClipboard::setMimeData
but I don't really know how to use it.
Basically in my app I want to search for particular files and copy them in the clipboard(the entire file, not the file name). So then when I use "Paste" in the Operating system it will copy exactly those files.
bye
Just check the link I gave above.
And as others said, u will need to set the proper format and data in the clipboard. Browse a little.
It's not the way it works. You copy file paths and then the target handles the paste (or drop as the mechanism is similar) and performs the copy. At least it works perfectly under KDE If you use local files or http/ftp Windows Explorer should handle it as well. As for other apps - it's up to them.
I tried with:
Qt Code:
myFile->setData("text/uri-list", "file:///C:/test80.png"); clipboard->setMimeData(myFile);To copy to clipboard, switch view to plain text mode
But it doesn't seem to work.
Any idea?
thanks
Where did you try to paste the file?
in a normal window, but after my setData the "Paste" command was disabled.
I guess something wrong with the Mime format, I'll investigate more
"Normal window" meaning...? The desktop? Try copying from the desktop and pasting in a Qt app and see what mime it uses.
Bookmarks