Solved Ctrl+V goes to wrong widget
-
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.
-
If you have this shortcut defined by
QShortcut
orQAction
it probably has too wide of a context. The default context for these classes isQt::WindowShortcut
, which means the shortcut triggers if the focus is anywhere in the window. You can change it toQt::WidgetWithChildrenShortcut
to scope it to the treeview alone. -
@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?
-
Hiding an unrelated widget was changing the focus. Weird, but I'll work around it. Thanks for your help!