QFocusFrame Class
The QFocusFrame class draws a frame around a widget, outside it. More…
| Header | #include <QFocusFrame> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
| Inherits | QWidget |
List of all members, including inherited members
Public Functions
| QFocusFrame(QWidget *parent = nullptr) | |
| ~QFocusFrame() | |
| void | setWidget(QWidget *widget) |
| QWidget * | widget() const |
Reimplemented Protected Functions
| bool | eventFilter(QObject *watched, QEvent *event) |
| void | paintEvent(QPaintEvent *event) |
Detailed Description
A focus frame follows a widget: it sits around it, in the parent of the widget, and moves, resizes, shows and hides with it. It is meant for showing the focus around a widget that does not draw it itself:
auto *frame = new QFocusFrame(window);
frame->setWidget(canvas);
The frame lets the mouse through to the widgets under it.
See also QRubberBand.
Differences from Qt
The frame is drawn by Nt in the highlight color, not by the style, and it follows the widget it was given rather than the focus.
Member Function Documentation
QFocusFrame::QFocusFrame(QWidget *parent = nullptr)
Constructs a focus frame with the given parent, which follows no widget.
QFocusFrame::~QFocusFrame()
Destroys the focus frame.
bool QFocusFrame::eventFilter(QObject *watched, QEvent *event)
Reimplements QWidget::eventFilter().
Follows the moves, resizes, shows and hides of the widget.
void QFocusFrame::paintEvent(QPaintEvent *event)
Reimplements QWidget::paintEvent().
void QFocusFrame::setWidget(QWidget *widget)
Makes the frame follow widget, or no widget if it is nullptr or a window. The frame becomes a child of the parent of the widget.
See also widget().
QWidget * QFocusFrame::widget() const
Returns the widget that the frame follows, or nullptr.