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。
聚焦框架不會監控 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
()
析構函數。
[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).
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 ().
返迴有自動重置大小和更新的目前監視 Widget。
另請參閱 QFocusFrame::setWidget ().