Use of setfocuspolicy () function

Source: Internet
Author: User

Parameter class of the setfocuspolicy () function
Qt: Enum focuspolicy {tabfocus \ clickfocus \ strongfocus \ wheelfocus \ nofocus}

Enum QT: focuspolicy
This Enum type defines the varous keys ies a widget can have with respect to acquiring keyboard focus.
Constant Value description
Qt: tabfocus 0x1 the widget accepts focus by tabbing.
Qt: clickfocus 0x2 the widget accepts focus by clicking.

Qt: strongfocus tabfocus | clickfocus | 0x8 the widget accepts focus by both tabbing and clicking. on Mac OS X this will also be indicate that the widget accepts tab focus when in 'text/list focus mode '.

Qt: wheelfocus strongfocus | 0x4 like QT: strongfocus plus the widget accepts focus by using the mouse wheel.
Qt: nofocus 0 the widget does not accept focus.

You must enable keyboard focus for a widget if it processes Keyboard Events. this is normally done from the widget's constructor. For instance, the qlineedit constructor CILS setfocuspolicy (QT: strongfocus ).

If the widget has a focus proxy, then the focus policy will be propagated to it.
Example:
UI-> textedit-> setfocuspolicy (QT: strongfocus );
UI-> textbrowser-> setfocuspolicy (QT: nofocus );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.