0

假设我有一个Qwidget包含三个子小部件的。如何通过按 Tab 键以外的键在子小部件之间移动焦点?中是否有任何内置机制Qt

4

1 回答 1

0

You can use setFocus() method of widgets. Note that you can only set a focus for a widget that accepts focus. For example, buttons, text edits accepts focus by default. Frames, labels do not. You can make widgets accepting focus using setFocusPolicy() but usually that is not required.

If your want to attach this action to another key or combination, you can use QShortcut. Also you can add an event filter to target widgets and detect keyboard events.

于 2013-07-02T17:15:27.543 回答