12 #include <QResizeEvent> 20 , Mover_ ([view] (const QPoint& pos) { view->move (pos); })
21 , Rect_ (std::move (size))
23 view->installEventFilter (
this);
24 Refit (view->size ());
30 , Mover_ ([window] (const QPoint& pos) { window->setPosition (pos); })
31 , Rect_ (std::move (size))
33 window->installEventFilter (
this);
34 Refit (window->size ());
42 auto re =
static_cast<QResizeEvent*
> (event);
47 void AutoResizeMixin::Refit (
const QSize& size)
QPoint FitRect(QPoint pos, const QSize &size, const QRect &geometry, FitFlags flags, const QPoint &shiftAdd)
Tries to fit a rectangle (like a dialog or popup) into geometry.
bool eventFilter(QObject *, QEvent *) override
Listens for resize events and refits the widget.
UTIL_GUI_API AutoResizeMixin(const QPoint &point, RectGetter_f rect, QWidget *widget)
Constructs the resize mixin.
std::function< QRect()> RectGetter_f
A function type used to get the rect to fit widget in.