Qt 4.8
qsizegrip.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qsizegrip.h"
43 
44 #ifndef QT_NO_SIZEGRIP
45 
46 #include "qapplication.h"
47 #include "qevent.h"
48 #include "qpainter.h"
49 #include "qstyle.h"
50 #include "qstyleoption.h"
51 #include "qlayout.h"
52 #include "qdebug.h"
53 #include <QDesktopWidget>
54 
55 #if defined(Q_WS_X11)
56 #include <private/qt_x11_p.h>
57 #elif defined (Q_WS_WIN)
58 #include "qt_windows.h"
59 #endif
60 #ifdef Q_WS_MAC
61 #include <private/qt_mac_p.h>
62 #endif
63 
64 #include <private/qwidget_p.h>
65 #include <QtGui/qabstractscrollarea.h>
66 
67 #define SZ_SIZEBOTTOMRIGHT 0xf008
68 #define SZ_SIZEBOTTOMLEFT 0xf007
69 #define SZ_SIZETOPLEFT 0xf004
70 #define SZ_SIZETOPRIGHT 0xf005
71 
73 
75 {
76  while (w && !w->isWindow() && w->windowType() != Qt::SubWindow)
77  w = w->parentWidget();
78  return w;
79 }
80 
82 {
84 public:
85  void init();
88  int d;
89  int dxMax;
90  int dyMax;
94 #ifdef Q_WS_MAC
95  void updateMacSizer(bool hide) const;
96 #endif
97  Qt::Corner corner() const;
98  inline bool atBottom() const
99  {
100  return m_corner == Qt::BottomRightCorner || m_corner == Qt::BottomLeftCorner;
101  }
102 
103  inline bool atLeft() const
104  {
105  return m_corner == Qt::BottomLeftCorner || m_corner == Qt::TopLeftCorner;
106  }
107 
109  {
110  Q_Q(QSizeGrip);
112  if (tlw == w)
113  return;
114  if (tlw)
115  tlw->removeEventFilter(q);
116  tlw = w;
117  if (tlw)
118  tlw->installEventFilter(q);
119  }
120 
121  // This slot is invoked by QLayout when the size grip is added to
122  // a layout or reparented after the tlw is shown. This re-implementation is basically
123  // the same as QWidgetPrivate::_q_showIfNotHidden except that it checks
124  // for Qt::WindowFullScreen and Qt::WindowMaximized as well.
126  {
127  Q_Q(QSizeGrip);
128  bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide));
130  if (tlw && showSizeGrip) {
131  Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
132 #ifndef Q_WS_MAC
133  sizeGripNotVisibleState |= Qt::WindowMaximized;
134 #endif
135  // Don't show the size grip if the tlw is maximized or in full screen mode.
136  showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState);
137  }
138  if (showSizeGrip)
139  q->setVisible(true);
140  }
141 };
142 
143 #ifdef Q_WS_MAC
144 void QSizeGripPrivate::updateMacSizer(bool hide) const
145 {
146  Q_Q(const QSizeGrip);
148  return;
149  QWidget *topLevelWindow = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q));
150  if(topLevelWindow && topLevelWindow->isWindow())
151  QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1);
152 }
153 #endif
154 
156 {
157  Q_Q(const QSizeGrip);
158  QWidget *tlw = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q));
159  const QPoint sizeGripPos = q->mapTo(tlw, QPoint(0, 0));
160  bool isAtBottom = sizeGripPos.y() >= tlw->height() / 2;
161  bool isAtLeft = sizeGripPos.x() <= tlw->width() / 2;
162  if (isAtLeft)
163  return isAtBottom ? Qt::BottomLeftCorner : Qt::TopLeftCorner;
164  else
165  return isAtBottom ? Qt::BottomRightCorner : Qt::TopRightCorner;
166 }
167 
213  : QWidget(*new QSizeGripPrivate, parent, 0)
214 {
215  Q_D(QSizeGrip);
216  d->init();
217 }
218 
219 #ifdef QT3_SUPPORT
220 
229 QSizeGrip::QSizeGrip(QWidget * parent, const char* name)
230  : QWidget(*new QSizeGripPrivate, parent, 0)
231 {
232  Q_D(QSizeGrip);
234  d->init();
235 }
236 #endif
237 
239 {
240  Q_Q(QSizeGrip);
241  dxMax = 0;
242  dyMax = 0;
243  tlw = 0;
244  m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner;
245  gotMousePress = false;
246 
247 #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC)
248  q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner
250 #endif
252  updateTopLevelWidget();
253 }
254 
255 
260 {
261 }
262 
267 {
268  QStyleOption opt(0);
269  opt.init(this);
270  return (style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this).
271  expandedTo(QApplication::globalStrut()));
272 }
273 
282 {
283  Q_UNUSED(event);
284  Q_D(QSizeGrip);
285  QPainter painter(this);
287  opt.init(this);
288  opt.corner = d->m_corner;
289  style()->drawControl(QStyle::CE_SizeGrip, &opt, &painter, this);
290 }
291 
300 {
301  if (e->button() != Qt::LeftButton) {
303  return;
304  }
305 
306  Q_D(QSizeGrip);
307  QWidget *tlw = qt_sizegrip_topLevelWidget(this);
308  d->p = e->globalPos();
309  d->gotMousePress = true;
310  d->r = tlw->geometry();
311 
312 #ifdef Q_WS_X11
313  // Use a native X11 sizegrip for "real" top-level windows if supported.
314  if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
317  XEvent xev;
318  xev.xclient.type = ClientMessage;
319  xev.xclient.message_type = ATOM(_NET_WM_MOVERESIZE);
320  xev.xclient.display = X11->display;
321  xev.xclient.window = tlw->winId();
322  xev.xclient.format = 32;
323  xev.xclient.data.l[0] = e->globalPos().x();
324  xev.xclient.data.l[1] = e->globalPos().y();
325  if (d->atBottom())
326  xev.xclient.data.l[2] = d->atLeft() ? 6 : 4; // bottomleft/bottomright
327  else
328  xev.xclient.data.l[2] = d->atLeft() ? 0 : 2; // topleft/topright
329  xev.xclient.data.l[3] = Button1;
330  xev.xclient.data.l[4] = 0;
331  XUngrabPointer(X11->display, X11->time);
332  XSendEvent(X11->display, QX11Info::appRootWindow(x11Info().screen()), False,
333  SubstructureRedirectMask | SubstructureNotifyMask, &xev);
334  return;
335  }
336 #endif // Q_WS_X11
337 #ifdef Q_WS_WIN
339  uint orientation = 0;
340  if (d->atBottom())
341  orientation = d->atLeft() ? SZ_SIZEBOTTOMLEFT : SZ_SIZEBOTTOMRIGHT;
342  else
343  orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT;
344 
345  ReleaseCapture();
346  PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0);
347  return;
348  }
349 #endif // Q_WS_WIN
350 
351  // Find available desktop/workspace geometry.
352  QRect availableGeometry;
353  bool hasVerticalSizeConstraint = true;
354  bool hasHorizontalSizeConstraint = true;
355  if (tlw->isWindow())
356  availableGeometry = QApplication::desktop()->availableGeometry(tlw);
357  else {
358  const QWidget *tlwParent = tlw->parentWidget();
359  // Check if tlw is inside QAbstractScrollArea/QScrollArea.
360  // If that's the case tlw->parentWidget() will return the viewport
361  // and tlw->parentWidget()->parentWidget() will return the scroll area.
362 #ifndef QT_NO_SCROLLAREA
363  QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget());
364  if (scrollArea) {
365  hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff;
366  hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff;
367  }
368 #endif // QT_NO_SCROLLAREA
369  availableGeometry = tlwParent->contentsRect();
370  }
371 
372  // Find frame geometries, title bar height, and decoration sizes.
373  const QRect frameGeometry = tlw->frameGeometry();
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);
377 
378  // Determine dyMax depending on whether the sizegrip is at the bottom
379  // of the widget or not.
380  if (d->atBottom()) {
381  if (hasVerticalSizeConstraint)
382  d->dyMax = availableGeometry.bottom() - d->r.bottom() - bottomDecoration;
383  else
384  d->dyMax = INT_MAX;
385  } else {
386  if (hasVerticalSizeConstraint)
387  d->dyMax = availableGeometry.y() - d->r.y() + titleBarHeight;
388  else
389  d->dyMax = -INT_MAX;
390  }
391 
392  // In RTL mode, the size grip is to the left; find dxMax from the desktop/workspace
393  // geometry, the size grip geometry and the width of the decoration.
394  if (d->atLeft()) {
395  if (hasHorizontalSizeConstraint)
396  d->dxMax = availableGeometry.x() - d->r.x() + leftRightDecoration;
397  else
398  d->dxMax = -INT_MAX;
399  } else {
400  if (hasHorizontalSizeConstraint)
401  d->dxMax = availableGeometry.right() - d->r.right() - leftRightDecoration;
402  else
403  d->dxMax = INT_MAX;
404  }
405 }
406 
407 
414 {
415  if (e->buttons() != Qt::LeftButton) {
417  return;
418  }
419 
420  Q_D(QSizeGrip);
421  QWidget* tlw = qt_sizegrip_topLevelWidget(this);
422  if (!d->gotMousePress || tlw->testAttribute(Qt::WA_WState_ConfigPending))
423  return;
424 
425 #ifdef Q_WS_X11
426  if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
427  && tlw->isTopLevel() && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint)
429  return;
430 #endif
431 #ifdef Q_WS_WIN
432  if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId()
434  MSG msg;
435  while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
436  return;
437  }
438 #endif
439 
440  QPoint np(e->globalPos());
441 
442  // Don't extend beyond the available geometry; bound to dyMax and dxMax.
443  QSize ns;
444  if (d->atBottom())
445  ns.rheight() = d->r.height() + qMin(np.y() - d->p.y(), d->dyMax);
446  else
447  ns.rheight() = d->r.height() - qMax(np.y() - d->p.y(), d->dyMax);
448 
449  if (d->atLeft())
450  ns.rwidth() = d->r.width() - qMax(np.x() - d->p.x(), d->dxMax);
451  else
452  ns.rwidth() = d->r.width() + qMin(np.x() - d->p.x(), d->dxMax);
453 
454  ns = QLayout::closestAcceptableSize(tlw, ns);
455 
456  QPoint p;
457  QRect nr(p, ns);
458  if (d->atBottom()) {
459  if (d->atLeft())
460  nr.moveTopRight(d->r.topRight());
461  else
462  nr.moveTopLeft(d->r.topLeft());
463  } else {
464  if (d->atLeft())
465  nr.moveBottomRight(d->r.bottomRight());
466  else
467  nr.moveBottomLeft(d->r.bottomLeft());
468  }
469 
470  tlw->setGeometry(nr);
471 }
472 
477 {
478  if (mouseEvent->button() == Qt::LeftButton) {
479  Q_D(QSizeGrip);
480  d->gotMousePress = false;
481  d->p = QPoint();
482  } else {
483  QWidget::mouseReleaseEvent(mouseEvent);
484  }
485 }
486 
490 void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/)
491 {
492  Q_D(QSizeGrip);
493  // We're inside a resize operation; no update necessary.
494  if (!d->p.isNull())
495  return;
496 
497  d->m_corner = d->corner();
498 #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC)
499  setCursor(d->m_corner == Qt::TopLeftCorner || d->m_corner == Qt::BottomRightCorner
501 #endif
502 }
503 
508 {
509 #ifdef Q_WS_MAC
510  d_func()->updateMacSizer(false);
511 #endif
512  QWidget::showEvent(showEvent);
513 }
514 
519 {
520 #ifdef Q_WS_MAC
521  d_func()->updateMacSizer(true);
522 #endif
523  QWidget::hideEvent(hideEvent);
524 }
525 
530 {
531  QWidget::setVisible(visible);
532 }
533 
536 {
537  Q_D(QSizeGrip);
540  || o != d->tlw) {
541  return QWidget::eventFilter(o, e);
542  }
543  Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
544 #ifndef Q_WS_MAC
545  sizeGripNotVisibleState |= Qt::WindowMaximized;
546 #endif
547  // Don't show the size grip if the tlw is maximized or in full screen mode.
548  setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState));
550  return QWidget::eventFilter(o, e);
551 }
552 
557 {
558  return QWidget::event(event);
559 }
560 
561 #ifdef Q_WS_WIN
562 
563 bool QSizeGrip::winEvent( MSG *m, long *result )
564 {
565  return QWidget::winEvent(m, result);
566 }
567 #endif
568 
570 
571 #include "moc_qsizegrip.cpp"
572 
573 #endif //QT_NO_SIZEGRIP
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
double d
Definition: qnumeric_p.h:62
void moveBottomRight(const QPoint &p)
Moves the rectangle, leaving the bottom-right corner at the given position.
Definition: qrect.h:374
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void mouseMoveEvent(QMouseEvent *)
Resizes the top-level widget containing this widget.
Definition: qsizegrip.cpp:413
virtual void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qwidget.cpp:9842
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Qt::ScrollBarPolicy horizontalScrollBarPolicy
the policy for the horizontal scroll bar
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QSizeGrip class provides a resize handle for resizing top-level windows.
Definition: qsizegrip.h:55
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
static QWidget * qt_sizegrip_topLevelWidget(QWidget *w)
Definition: qsizegrip.cpp:74
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
Qt::Corner corner() const
Definition: qsizegrip.cpp:155
QRect contentsRect() const
Returns the area inside the widget&#39;s margins.
Definition: qwidget.cpp:7544
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
static QSize globalStrut()
virtual void mouseReleaseEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse release even...
Definition: qwidget.cpp:9286
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
void updateMacSizer(bool hide) const
Definition: qsizegrip.cpp:144
virtual void mousePressEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
Definition: qwidget.cpp:9261
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void paintEvent(QPaintEvent *)
Paints the resize grip.
Definition: qsizegrip.cpp:281
QRect frameGeometry
geometry of the widget relative to its parent including any window frame
Definition: qwidget.h:159
const QX11Info & x11Info() const
Returns information about the configuration of the X display used to display the widget.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
Qt::ScrollBarPolicy verticalScrollBarPolicy
the policy for the vertical scroll bar
void init(const QWidget *w)
Use initFrom(widget) instead.
~QSizeGrip()
Destroys this size grip.
Definition: qsizegrip.cpp:259
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
bool atLeft() const
Definition: qsizegrip.cpp:103
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
T * qobject_cast(QObject *object)
Definition: qobject.h:375
virtual bool hasHeightForWidth() const
Definition: qwidget.cpp:10260
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define X11
Definition: qt_x11_p.h:724
Qt::Corner corner
The corner in which the size grip is located.
Definition: qstyleoption.h:859
#define Q_D(Class)
Definition: qglobal.h:2482
The QStyleOptionSizeGrip class is used to describe the parameter for drawing a size grip...
Definition: qstyleoption.h:853
static QSize closestAcceptableSize(const QWidget *w, const QSize &s)
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is ...
Definition: qlayout.cpp:1586
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QStyle * style() const
Definition: qwidget.cpp:2742
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
union _XEvent XEvent
Definition: qwindowdefs.h:116
bool isHidden() const
Returns true if the widget is hidden, otherwise returns false.
Definition: qwidget.h:1008
#define ATOM(x)
Definition: qt_x11_p.h:723
bool winEvent(MSG *m, long *result)
Reimplemented Function
Definition: qsizegrip.cpp:563
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool eventFilter(QObject *, QEvent *)
Reimplemented Function
Definition: qsizegrip.cpp:535
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
void mouseReleaseEvent(QMouseEvent *mouseEvent)
Reimplemented Function
Definition: qsizegrip.cpp:476
bool visible
whether the widget is visible
Definition: qwidget.h:191
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a widget which is a child of parent, with widget flags set to f.
Definition: qwidget.cpp:1189
void _q_showIfNotHidden()
Definition: qsizegrip.cpp:125
#define SZ_SIZETOPLEFT
Definition: qsizegrip.cpp:69
void moveTopRight(const QPoint &p)
Moves the rectangle, leaving the top-right corner at the given position.
Definition: qrect.h:380
const char * name
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
#define SZ_SIZETOPRIGHT
Definition: qsizegrip.cpp:70
unsigned int uint
Definition: qglobal.h:996
#define FALSE
Synonym for false.
Definition: qglobal.h:1019
QSizeGrip(QWidget *parent)
Constructs a resize corner as a child widget of the given parent.
Definition: qsizegrip.cpp:212
void setCursor(const QCursor &)
Definition: qwidget.cpp:5290
void hideEvent(QHideEvent *hideEvent)
Reimplemented Function
Definition: qsizegrip.cpp:518
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
bool event(QEvent *)
Reimplemented Function
Definition: qsizegrip.cpp:556
Qt::MouseButton button() const
Returns the button that caused the event.
Definition: qevent.h:101
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void mousePressEvent(QMouseEvent *)
Receives the mouse press events for the widget, and primes the resize operation.
Definition: qsizegrip.cpp:299
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
Definition: qrect.h:368
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
Corner
Definition: qnamespace.h:1456
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
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.
Definition: qrect.h:386
struct tagMSG MSG
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition: qevent.h:102
void updateTopLevelWidget()
Definition: qsizegrip.cpp:108
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&#39;s right edge.
Definition: qrect.h:246
#define SZ_SIZEBOTTOMRIGHT
Definition: qsizegrip.cpp:67
virtual bool winEvent(MSG *message, long *result)
This special event handler can be reimplemented in a subclass to receive native Windows events which ...
Definition: qwidget.cpp:9941
bool atBottom() const
Definition: qsizegrip.cpp:98
virtual void hideEvent(QHideEvent *)
This event handler can be reimplemented in a subclass to receive widget hide events.
Definition: qwidget.cpp:9864
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void setVisible(bool)
Reimplemented Function
Definition: qsizegrip.cpp:529
QRect frameGeometry() const
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
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
Definition: qsizegrip.cpp:266
int & rheight()
Returns a reference to the height.
Definition: qsize.h:144
void showEvent(QShowEvent *showEvent)
Reimplemented Function
Definition: qsizegrip.cpp:507
bool isTopLevel() const
Use isWindow() instead.
Definition: qwidget.h:942
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QObject * parent
Definition: qobject.h:92
friend Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
Qt::Corner m_corner
Definition: qsizegrip.cpp:91
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
const QRect availableGeometry(int screen=-1) const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
virtual void mouseMoveEvent(QMouseEvent *)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition: qwidget.cpp:9239
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
Definition: qevent.h:96
QWidget * tlw
Definition: qsizegrip.cpp:93
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
#define INT_MAX
#define SZ_SIZEBOTTOMLEFT
Definition: qsizegrip.cpp:68
void moveEvent(QMoveEvent *moveEvent)
Reimplemented Function
Definition: qsizegrip.cpp:490