Paste from clipboard does not work across different files. This patch is to fix this issue, given that for cut-paste operation both files need to be open.
BUG: 404595
FIXED-IN: krita 4.2.0-pre-alpha (git 03db690)
Lint Skipped |
Unit Tests Skipped |
This seems like a very useful addition. However, there's a couple of problems with this approach that need to be addressed.
First, copying from an image to another does not work across different windows. The model of one timeline widget doesn't know about the cutCopyImageRoot field of the other. Secondly, keeping a shared pointer to the root will effectively keep the whole image in memory, even if the document gets closed.
I would prefer to include some kind of an identifier for the image in the mime data (similarly to the node UUIDs). When pasting, we can then search through open documents (see KisPart::documents()) for the matching image.
I looked at @jounip 's approach, but it does not seem to work. Keeping a shared pointer to the root keeps the whole image in memory, but it can be accessed only through the same shared pointer and not by searching over the open documents through KisPart::documents().
I found a different approach and it does seem to work even if the documents are closed. However, the problem that still remains is making it work across windows. Apparently, that is a problem with QClipboard itself and can't be achieved through QClipboard.
[https://stackoverflow.com/questions/40081849/qt-c-can-i-use-custom-mime-type-for-copy-and-paste-on-multiple-application]
About gitlab -- I have no idea yet. This is so new and young, we're all fishes grasping for air.
https://invent.kde.org/kde/krita/merge_requests/8
let's make sure to link in the comments.
Ashwin, can you 'abandon this commit'?