10#include <qpa/qplatformwindow.h>
16#include <private/qwidget_p.h>
17#include "private/qapplication_p.h"
18#include <qpa/qplatformtheme.h>
19#include <QtWidgets/qabstractscrollarea.h>
21#include <QtCore/qpointer.h>
28 w =
w->parentWidget();
45 QPointer<QWidget>
tlw;
80 if (
tlw && showSizeGrip) {
96 , gotMousePress(
false)
98 , m_platformSizeGrip(
false)
107 bool isAtBottom = sizeGripPos.
y() >=
tlw->
height() / 2;
108 bool isAtLeft = sizeGripPos.x() <=
tlw->
width() / 2;
180#if !defined(QT_NO_CURSOR)
220 opt.corner =
d->m_corner;
249 && platformName == u
"windows") {
265 d->gotMousePress =
true;
269 d->m_platformSizeGrip =
false;
281 if (
d->m_platformSizeGrip)
285 QRect availableGeometry;
286 bool hasVerticalSizeConstraint =
true;
287 bool hasHorizontalSizeConstraint =
true;
299#if QT_CONFIG(scrollarea)
300 QAbstractScrollArea *
scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget());
306 availableGeometry = tlwParent->contentsRect();
318 if (hasVerticalSizeConstraint)
319 d->dyMax = availableGeometry.
bottom() -
d->r.bottom() - bottomDecoration;
323 if (hasVerticalSizeConstraint)
324 d->dyMax = availableGeometry.
y() -
d->r.y() + titleBarHeight;
332 if (hasHorizontalSizeConstraint)
333 d->dxMax = availableGeometry.
x() -
d->r.x() + leftRightDecoration;
337 if (hasHorizontalSizeConstraint)
338 d->dxMax = availableGeometry.
right() -
d->r.right() - leftRightDecoration;
367 ns.rheight() =
d->r.height() +
qMin(np.y() -
d->p.y(),
d->dyMax);
369 ns.rheight() =
d->r.height() -
qMax(np.y() -
d->p.y(),
d->dyMax);
372 ns.rwidth() =
d->r.width() -
qMax(np.x() -
d->p.x(),
d->dxMax);
374 ns.rwidth() =
d->r.width() +
qMin(np.x() -
d->p.x(),
d->dxMax);
382 nr.moveTopRight(
d->r.topRight());
384 nr.moveTopLeft(
d->r.topLeft());
387 nr.moveBottomRight(
d->r.bottomRight());
389 nr.moveBottomLeft(
d->r.bottomLeft());
402 d->gotMousePress =
false;
419 d->m_corner =
d->corner();
420#if !defined(QT_NO_CURSOR)
454 if (
d->isExplicitlyHidden()
462 setVisible(!(
d->tlw->windowState() & sizeGripNotVisibleState));
477#include "moc_qsizegrip.cpp"
Type type() const
Returns the event type.
static QPlatformTheme * platformTheme()
QString platformName
The name of the underlying platform plugin.
The QHideEvent class provides an event which is sent after a widget is hidden.
static QSize closestAcceptableSize(const QWidget *w, const QSize &s)
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is ...
The QMoveEvent class contains event parameters for move events.
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
The QPaintEvent class contains event parameters for paint events.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
QRect availableVirtualGeometry
the available geometry of the virtual desktop to which this screen belongs
The QShowEvent class provides an event that is sent when a widget is shown.
QPointF globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
Qt::MouseButton button() const
Returns the button that caused the event.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
void _q_showIfNotHidden()
void updateTopLevelWidget()
Qt::Corner corner() const
The QSizeGrip class provides a resize handle for resizing top-level windows.
QSize sizeHint() const override
\reimp
void mousePressEvent(QMouseEvent *) override
Receives the mouse press events for the widget, and primes the resize operation.
bool eventFilter(QObject *, QEvent *) override
\reimp
void showEvent(QShowEvent *showEvent) override
\reimp
void hideEvent(QHideEvent *hideEvent) override
\reimp
void paintEvent(QPaintEvent *) override
Paints the resize grip.
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
\reimp
void moveEvent(QMoveEvent *moveEvent) override
\reimp
QSizeGrip(QWidget *parent)
Constructs a resize corner as a child widget of the given parent.
bool event(QEvent *) override
\reimp
void mouseMoveEvent(QMouseEvent *) override
Resizes the top-level widget containing this widget.
void setVisible(bool) override
\reimp
~QSizeGrip()
Destroys this size grip.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
Combined button and popup list for selecting options.
@ WA_WState_ExplicitShowHide
@ WA_TranslucentBackground
@ WA_WState_ConfigPending
@ X11BypassWindowManagerHint
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLdouble GLdouble GLdouble GLdouble q
static Qt::Edges edgesFromCorner(Qt::Corner corner)
static bool usePlatformSizeGrip(const QWidget *tlw)
static QT_BEGIN_NAMESPACE QWidget * qt_sizegrip_topLevelWidget(QWidget *w)
QT_BEGIN_NAMESPACE bool toBool(const QString &str)