Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using Shortcut type to implement Ctrl+C copy
Servers for Qt installer are currently down

Using Shortcut type to implement Ctrl+C copy

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 150 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bob64
    wrote on 25 Apr 2023, 22:35 last edited by Bob64
    #1

    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 using TextInput to implement delegates for each line.

    I tried adding a Shortcut object as a child of the ListView, 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 with TextEdit. Ctrl+C copying is another example of this.

    1 Reply Last reply
    0

    1/1

    25 Apr 2023, 22:35

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved