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.
FIXED-IN: krita 4.2.0-pre-alpha (git 03db690)
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.