QFocusFrame 类

QFocusFrame 小部件提供的聚焦框可以在 Widget 的正常可描绘区域之外。 更多...

头: #include <QFocusFrame>
qmake: QT += widgets
继承: QWidget

公共函数

QFocusFrame (QWidget * parent = nullptr)
virtual ~QFocusFrame ()
void setWidget (QWidget * widget )
QWidget * widget () const

保护函数

void initStyleOption (QStyleOption * option ) const

重实现保护函数

virtual bool event (QEvent * e ) override
virtual bool eventFilter (QObject * o , QEvent * e ) override
virtual void paintEvent ( QPaintEvent * ) override

详细描述

通常,应用程序不需要创建自己的 QFocusFrame 因为 QStyle 会处理此细节。样式编写者可以可选地使用 QFocusFrame 以在 Widget 可描绘几何体之外拥有聚焦区域。以此方式,不需要为 Widget 预留聚焦空间,而仅设置在 QWidget with QFocusFrame::setWidget 。不管怎样,它是合法的在自定义 Widget 中创建自己的 QFocusFrame 并手动设置其几何体凭借 QWidget::setGeometry 但不会自动放置,当聚焦 Widget 改变大小或放置时。

成员函数文档编制

QFocusFrame:: QFocusFrame ( QWidget * parent = nullptr)

构造 QFocusFrame。

聚焦框架不会监控 parent for updates but rather can be placed manually or by using QFocusFrame::setWidget . A QFocusFrame sets Qt::WA_NoChildEventsForParent attribute; as a result the parent will not receive a QEvent::ChildAdded event, this will make it possible to manually set the geometry of the QFocusFrame inside of a QSplitter or other child event monitoring widget.

另请参阅 QFocusFrame::setWidget ().

[virtual] QFocusFrame:: ~QFocusFrame ()

析构函数。

[override virtual protected] bool QFocusFrame:: event ( QEvent * e )

重实现: QWidget::event (QEvent *event).

[override virtual protected] bool QFocusFrame:: eventFilter ( QObject * o , QEvent * e )

重实现: QObject::eventFilter (QObject *watched, QEvent *event).

[protected] void QFocusFrame:: initStyleOption ( QStyleOption * option ) const

初始化 option 采用值来自此 QFocusFrame 。此方法对子类是有用的,当需要 QStyleOption ,但不希望自己填充所有信息。

另请参阅 QStyleOption::initFrom ().

[override virtual protected] void QFocusFrame:: paintEvent ( QPaintEvent * )

重实现: QWidget::paintEvent (QPaintEvent *event).

void QFocusFrame:: setWidget ( QWidget * widget )

QFocusFrame will track changes to widget and resize itself automatically. If the monitored widget's parent changes, QFocusFrame will follow the widget and place itself around the widget automatically. If the monitored widget is deleted, QFocusFrame will set it to zero.

另请参阅 QFocusFrame::widget ().

QWidget *QFocusFrame:: widget () const

返回自动重置尺寸和更新的当前监视 Widget。

另请参阅 QFocusFrame::setWidget ().