问题
(This picture is from Qt official site, and I take it as an example.)
I'd like to escape some unimportant widgets from being tab-focused.
(This strategy is useful if you have a widget that you want to quickly rotate between some commonly used QLineEdit
to enter data and escape those rarely used settings.)
Take the picture as an example, is it possible to exclude Width and Height from tab-ordering list so I can use Tab to rotate only between Name
, Color depth
, OK
and Cancel
? I've searched the document and didn't find the option to remove widgets from tab-ordering list.
回答1:
Change the focus policy of your widgets that you don't want in the tab order list.
The policy is Qt::TabFocus if the widget accepts keyboard focus by tabbing.
You will have to set it to Qt::ClickFocus
or Qt::NoFocus
to remove it from the tab order list.
See what different focus policies do here.
来源:https://stackoverflow.com/questions/23953143/how-to-exclude-a-widget-from-tab-ordering-list