Using Shortcut type to implement Ctrl+C copy
-
wrote on 25 Apr 2023, 22:35 last edited by Bob64
I would like to attach Ctrl+C copy behaviour to a custom multiline
TextEdit
-like component in my application.It's actually essentially a
ListView
usingTextInput
to implement delegates for each line.I tried adding a
Shortcut
object as a child of theListView
, thus:Shortcut { sequences: [StandardKey.Copy, "Ctrl+C"] onActivated: console.log("activated") }
However it is never triggered. There is hardly any documentation on
Shortcut
. I have done something similar to what is shown in the documentation that exists, but I have no clues as to why it doesn't work.I know how to implement the copying if I can trigger
onActivated
as I already have it working for right-click and a pop-up menu.Unfortunately my custom text view is necessary as it is used to display logs that can run to many 1000s of lines and this is the only way I could find to get reasonable performance -
TextEdit
became useless beyond a certain point. This means that I have had to implement a lot of stuff like multi-line selection myself, which would have come free withTextEdit
.Ctrl+C
copying is another example of this.
1/1