Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Ctrl+V goes to wrong widget
Qt 6.11 is out! See what's new in the release blog

Ctrl+V goes to wrong widget

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 963 Views 2 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    If I set the paste shortcut on my treeview, place the cursor into a custom editor component, and do Ctrl+V - the treeview steals the paste action despite being out of focus.

    How do I go about debugging this? Ctrl+V works fine in the editor component without the shortcut set on the treeview.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      If you have this shortcut defined by QShortcut or QAction it probably has too wide of a context. The default context for these classes is Qt::WindowShortcut, which means the shortcut triggers if the focus is anywhere in the window. You can change it to Qt::WidgetWithChildrenShortcut to scope it to the treeview alone.

      1 Reply Last reply
      3
      • V Offline
        V Offline
        Vadi2
        wrote on last edited by
        #3

        @Chris-Kawa said in Ctrl+V goes to wrong widget:

        WidgetWithChildrenShortcut

        Nice, that helped, but now right after pasting the focus changes from the treeview to the next input line after it. How can I have the focus stay where it is after a paste?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vadi2
          wrote on last edited by
          #4

          Hiding an unrelated widget was changing the focus. Weird, but I'll work around it. Thanks for your help!

          1 Reply Last reply
          0

          • Login

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