现在的位置: 首页 > 综合 > 正文

QT setFocusProxy

2012年04月08日 ⁄ 综合 ⁄ 共 746字 ⁄ 字号 评论关闭
void QWidget::setFocusProxy ( QWidget * w ) [virtual]

Sets this widget's focus proxy to w. If w is 0, this function resets this widget to not have any focus proxy.

Some widgets, such as QComboBox, can "have focus," but create a child widget to actually handle the focus. QComboBox, for example, creates a QLineEdit.

setFocusProxy() sets the widget which will actually get focus when "this widget" gets it. If there is a focus proxy, focusPolicy(), setFocusPolicy(), setFocus() and hasFocus() all operate on the focus proxy.

See also focusProxy().

将该widget的focus proxy设置给w。如果w为0,该函数将此widget设为没有任何focus proxy。

有些widget,比如QComboBox,可以“拥有focus”,但是它们会创建一个子的widget来实际地处理焦点。比如QComboBox创建的叫做QLineEdit。

setFocusProxy()用来指定当该widget获得焦点时实际上由谁来处理这个焦点。如果某个widget拥有focus proxy,focusPolicy(),setFocusPolicy(),setFocus()和hasFocus()都是对focus proxy进行操作。

抱歉!评论已关闭.