44 #ifndef QT_NO_SIZEGRIP 53 #include <QDesktopWidget> 56 #include <private/qt_x11_p.h> 57 #elif defined (Q_WS_WIN) 61 #include <private/qt_mac_p.h> 64 #include <private/qwidget_p.h> 65 #include <QtGui/qabstractscrollarea.h> 67 #define SZ_SIZEBOTTOMRIGHT 0xf008 68 #define SZ_SIZEBOTTOMLEFT 0xf007 69 #define SZ_SIZETOPLEFT 0xf004 70 #define SZ_SIZETOPRIGHT 0xf005 130 if (tlw && showSizeGrip) {
136 showSizeGrip = !(tlw->
windowState() & sizeGripNotVisibleState);
150 if(topLevelWindow && topLevelWindow->
isWindow())
151 QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1);
160 bool isAtBottom = sizeGripPos.
y() >= tlw->
height() / 2;
161 bool isAtLeft = sizeGripPos.
x() <= tlw->
width() / 2;
245 gotMousePress =
false;
247 #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC) 252 updateTopLevelWidget();
309 d->gotMousePress =
true;
318 xev.xclient.type = ClientMessage;
320 xev.xclient.display =
X11->display;
321 xev.xclient.window = tlw->
winId();
322 xev.xclient.format = 32;
326 xev.xclient.data.l[2] =
d->atLeft() ? 6 : 4;
328 xev.xclient.data.l[2] =
d->atLeft() ? 0 : 2;
329 xev.xclient.data.l[3] = Button1;
330 xev.xclient.data.l[4] = 0;
331 XUngrabPointer(
X11->display,
X11->time);
333 SubstructureRedirectMask | SubstructureNotifyMask, &xev);
339 uint orientation = 0;
346 PostMessage(tlw->
winId(), WM_SYSCOMMAND, orientation, 0);
352 QRect availableGeometry;
353 bool hasVerticalSizeConstraint =
true;
354 bool hasHorizontalSizeConstraint =
true;
362 #ifndef QT_NO_SCROLLAREA 368 #endif // QT_NO_SCROLLAREA 374 const int titleBarHeight =
qMax(tlw->
geometry().
y() - frameGeometry.
y(), 0);
375 const int bottomDecoration =
qMax(frameGeometry.
height() - tlw->
height() - titleBarHeight, 0);
376 const int leftRightDecoration =
qMax((frameGeometry.
width() - tlw->
width()) / 2, 0);
381 if (hasVerticalSizeConstraint)
382 d->dyMax = availableGeometry.
bottom() -
d->r.bottom() - bottomDecoration;
386 if (hasVerticalSizeConstraint)
387 d->dyMax = availableGeometry.
y() -
d->r.y() + titleBarHeight;
395 if (hasHorizontalSizeConstraint)
396 d->dxMax = availableGeometry.
x() -
d->r.x() + leftRightDecoration;
400 if (hasHorizontalSizeConstraint)
401 d->dxMax = availableGeometry.
right() -
d->r.right() - leftRightDecoration;
435 while(PeekMessage(&msg,
winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
447 ns.rheight() =
d->r.height() -
qMax(np.y() -
d->p.y(),
d->dyMax);
450 ns.rwidth() =
d->r.width() -
qMax(np.x() -
d->p.x(),
d->dxMax);
452 ns.rwidth() =
d->r.width() +
qMin(np.x() -
d->p.x(),
d->dxMax);
480 d->gotMousePress =
false;
497 d->m_corner =
d->corner();
498 #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC) 510 d_func()->updateMacSizer(
false);
521 d_func()->updateMacSizer(
true);
548 setVisible(!(
d->tlw->windowState() & sizeGripNotVisibleState));
571 #include "moc_qsizegrip.cpp" 573 #endif //QT_NO_SIZEGRIP The QPainter class performs low-level painting on widgets and other paint devices.
void moveBottomRight(const QPoint &p)
Moves the rectangle, leaving the bottom-right corner at the given position.
void mouseMoveEvent(QMouseEvent *)
Resizes the top-level widget containing this widget.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
The QSizeGrip class provides a resize handle for resizing top-level windows.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
static QWidget * qt_sizegrip_topLevelWidget(QWidget *w)
Qt::Corner corner() const
static QSize globalStrut()
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
void updateMacSizer(bool hide) const
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
void paintEvent(QPaintEvent *)
Paints the resize grip.
int width() const
Returns the width of the rectangle.
void init(const QWidget *w)
Use initFrom(widget) instead.
~QSizeGrip()
Destroys this size grip.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
T * qobject_cast(QObject *object)
The QObject class is the base class of all Qt objects.
Qt::Corner corner
The corner in which the size grip is located.
The QStyleOptionSizeGrip class is used to describe the parameter for drawing a size grip...
static QSize closestAcceptableSize(const QWidget *w, const QSize &s)
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is ...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setObjectName(const QString &name)
bool winEvent(MSG *m, long *result)
Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool eventFilter(QObject *, QEvent *)
Reimplemented Function
The QMoveEvent class contains event parameters for move events.
void mouseReleaseEvent(QMouseEvent *mouseEvent)
Reimplemented Function
The QStyleOption class stores the parameters used by QStyle functions.
void _q_showIfNotHidden()
void moveTopRight(const QPoint &p)
Moves the rectangle, leaving the top-right corner at the given position.
The QHideEvent class provides an event which is sent after a widget is hidden.
#define FALSE
Synonym for false.
QSizeGrip(QWidget *parent)
Constructs a resize corner as a child widget of the given parent.
void hideEvent(QHideEvent *hideEvent)
Reimplemented Function
The QShowEvent class provides an event that is sent when a widget is shown.
bool event(QEvent *)
Reimplemented Function
Qt::MouseButton button() const
Returns the button that caused the event.
void mousePressEvent(QMouseEvent *)
Receives the mouse press events for the widget, and primes the resize operation.
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
The QMouseEvent class contains parameters that describe a mouse event.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
void moveBottomLeft(const QPoint &p)
Moves the rectangle, leaving the bottom-left corner at the given position.
#define Q_DECLARE_PUBLIC(Class)
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
void updateTopLevelWidget()
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
int right() const
Returns the x-coordinate of the rectangle's right edge.
#define SZ_SIZEBOTTOMRIGHT
int y() const
Returns the y-coordinate of the rectangle's top edge.
void setVisible(bool)
Reimplemented Function
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
QSize sizeHint() const
Reimplemented Function
int & rheight()
Returns a reference to the height.
void showEvent(QShowEvent *showEvent)
Reimplemented Function
The QRect class defines a rectangle in the plane using integer precision.
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
int y() const
Returns the y coordinate of this point.
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
#define SZ_SIZEBOTTOMLEFT
void moveEvent(QMoveEvent *moveEvent)
Reimplemented Function