QFocusFrame Class

QFocusFrame 提供一个可以放置于widget正常绘制区域外的焦点框. 更多...

头文件: #include <QFocusFrame>
qmake: QT += widgets
基类: QWidget

公有函数

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

受保护的函数

void initStyleOption(QStyleOption *option) const

重新实现的受保护函数

virtual bool event(QEvent *e)
virtual bool eventFilter(QObject *o, QEvent *e)
virtual void paintEvent(QPaintEvent *)
  • 35 个受保护的函数继承自 QWidget
  • 9 个受保护的函数继承自 QObject
  • 1 个受保护的函数继承自 QPaintDevice

其他继承的成员

详细描述

QFocusFrame 提供一个可以放置于widget正常绘制区域外的焦点框.

一般而言, 应用程序不需要创建 QFocusFrame , QStyle 会处理这个细节. 样式生成器使用 QFocusFrame 在绘制区域外获取焦点. 利用这种方式, QWidget不需要预留空间获取焦点, 只需要调用 QFocusFrame::setWidget. 虽然, 你可以在自定义的widget上创建自己的 QFocusFrame , 并调用 QWidget::setGeometry 设置它的几何形状, 但是, 具有焦点的widget改变大小和位置时不能自适应.

成员函数

QFocusFrame::QFocusFrame(QWidget *parent = Q_NULLPTR)

Constructs a QFocusFrame.

The focus frame will not monitor 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().

QFocusFrame::~QFocusFrame()

Destructor.

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

重新实现 QObject::event().

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

重新实现 QObject::eventFilter().

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

Initialize option with the values from this QFocusFrame. This method is useful for subclasses when they need a QStyleOption, but don't want to fill in all the information themselves.

参见 QStyleOption::initFrom().

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

重新实现 QWidget::paintEvent().

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

Returns the currently monitored widget for automatically resize and update.

参见 QFocusFrame::setWidget().