Fixed: Paste from clipboard across different files

Authored by ashwind on Mar 3 2019, 11:12 AM.


Group Reviewers

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)

Diff Detail

R37 Krita
Lint Skipped
Unit Tests Skipped
ashwind requested review of this revision.Mar 3 2019, 11:12 AM
ashwind created this revision.
woltherav added a subscriber: woltherav.

Adding jouni to the reviewers explicitely.

jounip requested changes to this revision.Mar 11 2019, 4:25 PM

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.

This revision now requires changes to proceed.Mar 11 2019, 4:25 PM

Ok I will look at it.

ashwind updated this revision to Diff 56591.Fri, Apr 19, 2:20 PM

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.

ashwind updated this revision to Diff 56596.Fri, Apr 19, 2:46 PM
This comment was removed by ashwind.
rempt added a subscriber: rempt.Fri, Apr 19, 6:26 PM

About gitlab -- I have no idea yet. This is so new and young, we're all fishes grasping for air.

Ok i will move it there asap. :-)

Moved to gitlab :-)

let's make sure to link in the comments.

Ashwin, can you 'abandon this commit'?

ashwind abandoned this revision.Sat, Apr 20, 10:24 AM