| Line | Source Code | Coverage | 
|---|
| 1 | /**************************************************************************** | - | 
| 2 | ** | - | 
| 3 | ** Copyright (C) 2013 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 "qwindow.h" | - | 
| 50 | #include <qpa/qplatformwindow.h> | - | 
| 51 | #include "qstyle.h" | - | 
| 52 | #include "qstyleoption.h" | - | 
| 53 | #include "qlayout.h" | - | 
| 54 | #include "qdebug.h" | - | 
| 55 | #include <QDesktopWidget> | - | 
| 56 |  | - | 
| 57 | #ifdef Q_WS_MAC | - | 
| 58 | #include <private/qt_mac_p.h> | - | 
| 59 | #endif | - | 
| 60 |  | - | 
| 61 | #include <private/qwidget_p.h> | - | 
| 62 | #include <QtWidgets/qabstractscrollarea.h> | - | 
| 63 |  | - | 
| 64 | QT_BEGIN_NAMESPACE | - | 
| 65 |  | - | 
| 66 | static QWidget *qt_sizegrip_topLevelWidget(QWidget* w) | - | 
| 67 | { | - | 
| 68 | while (w && !w->isWindow() && w->windowType() != Qt::SubWindow) partially evaluated:  w| yes Evaluation Count:602 | no Evaluation Count:0 | 
 evaluated:  !w->isWindow()| yes Evaluation Count:312 | yes Evaluation Count:290 | 
 evaluated:  w->windowType() != Qt::SubWindow| yes Evaluation Count:310 | yes Evaluation Count:2 | 
 | 0-602 | 
| 69 | w = w->parentWidget(); executed:  w = w->parentWidget();Execution Count:310 | 310 | 
| 70 | return w; executed:  return w;Execution Count:292 | 292 | 
| 71 | } | - | 
| 72 |  | - | 
| 73 | class QSizeGripPrivate : public QWidgetPrivate | - | 
| 74 | { | - | 
| 75 | Q_DECLARE_PUBLIC(QSizeGrip) | - | 
| 76 | public: | - | 
| 77 | QSizeGripPrivate(); | - | 
| 78 | void init(); | - | 
| 79 | QPoint p; | - | 
| 80 | QRect r; | - | 
| 81 | int d; | - | 
| 82 | int dxMax; | - | 
| 83 | int dyMax; | - | 
| 84 | Qt::Corner m_corner; | - | 
| 85 | bool gotMousePress; | - | 
| 86 | QWidget *tlw; | - | 
| 87 | #ifdef Q_WS_MAC | - | 
| 88 | void updateMacSizer(bool hide) const; | - | 
| 89 | #endif | - | 
| 90 | Qt::Corner corner() const; | - | 
| 91 | inline bool atBottom() const | - | 
| 92 | { | - | 
| 93 | return m_corner == Qt::BottomRightCorner || m_corner == Qt::BottomLeftCorner; never executed: return m_corner == Qt::BottomRightCorner || m_corner == Qt::BottomLeftCorner; | 0 | 
| 94 | } | - | 
| 95 |  | - | 
| 96 | inline bool atLeft() const | - | 
| 97 | { | - | 
| 98 | return m_corner == Qt::BottomLeftCorner || m_corner == Qt::TopLeftCorner; never executed: return m_corner == Qt::BottomLeftCorner || m_corner == Qt::TopLeftCorner; | 0 | 
| 99 | } | - | 
| 100 |  | - | 
| 101 | void updateTopLevelWidget() | - | 
| 102 | { | - | 
| 103 | Q_Q(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGrip * const q = q_func(); | - | 
| 104 | QWidget *w = qt_sizegrip_topLevelWidget(q); executed (the execution status of this line is deduced):  QWidget *w = qt_sizegrip_topLevelWidget(q); | - | 
| 105 | if (tlw == w) evaluated:  tlw == w| yes Evaluation Count:6 | yes Evaluation Count:216 | 
 | 6-216 | 
| 106 | return; executed:  return;Execution Count:6 | 6 | 
| 107 | if (tlw) evaluated:  tlw| yes Evaluation Count:1 | yes Evaluation Count:215 | 
 | 1-215 | 
| 108 | tlw->removeEventFilter(q); executed:  tlw->removeEventFilter(q);Execution Count:1 | 1 | 
| 109 | tlw = w; executed (the execution status of this line is deduced):  tlw = w; | - | 
| 110 | if (tlw) partially evaluated:  tlw| yes Evaluation Count:216 | no Evaluation Count:0 | 
 | 0-216 | 
| 111 | tlw->installEventFilter(q); executed:  tlw->installEventFilter(q);Execution Count:216 | 216 | 
| 112 | } executed:  }Execution Count:216 | 216 | 
| 113 |  | - | 
| 114 | // This slot is invoked by QLayout when the size grip is added to | - | 
| 115 | // a layout or reparented after the tlw is shown. This re-implementation is basically | - | 
| 116 | // the same as QWidgetPrivate::_q_showIfNotHidden except that it checks | - | 
| 117 | // for Qt::WindowFullScreen and Qt::WindowMaximized as well. | - | 
| 118 | void _q_showIfNotHidden() | - | 
| 119 | { | - | 
| 120 | Q_Q(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGrip * const q = q_func(); | - | 
| 121 | bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)); partially evaluated:  q->isHidden()| yes Evaluation Count:7 | no Evaluation Count:0 | 
 partially evaluated:  q->testAttribute(Qt::WA_WState_ExplicitShowHide)| no Evaluation Count:0 | yes Evaluation Count:7 | 
 | 0-7 | 
| 122 | updateTopLevelWidget(); executed (the execution status of this line is deduced):  updateTopLevelWidget(); | - | 
| 123 | if (tlw && showSizeGrip) { partially evaluated:  tlw| yes Evaluation Count:7 | no Evaluation Count:0 | 
 partially evaluated:  showSizeGrip| yes Evaluation Count:7 | no Evaluation Count:0 | 
 | 0-7 | 
| 124 | Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; executed (the execution status of this line is deduced):  Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; | - | 
| 125 | #ifndef Q_WS_MAC | - | 
| 126 | sizeGripNotVisibleState |= Qt::WindowMaximized; executed (the execution status of this line is deduced):  sizeGripNotVisibleState |= Qt::WindowMaximized; | - | 
| 127 | #endif | - | 
| 128 | // Don't show the size grip if the tlw is maximized or in full screen mode. | - | 
| 129 | showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState); executed (the execution status of this line is deduced):  showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState); | - | 
| 130 | } executed:  }Execution Count:7 | 7 | 
| 131 | if (showSizeGrip) evaluated:  showSizeGrip| yes Evaluation Count:5 | yes Evaluation Count:2 | 
 | 2-5 | 
| 132 | q->setVisible(true); executed:  q->setVisible(true);Execution Count:5 | 5 | 
| 133 | } executed:  }Execution Count:7 | 7 | 
| 134 |  | - | 
| 135 | bool m_platformSizeGrip; | - | 
| 136 | }; | - | 
| 137 |  | - | 
| 138 | QSizeGripPrivate::QSizeGripPrivate() | - | 
| 139 | : dxMax(0) | - | 
| 140 | , dyMax(0) | - | 
| 141 | , gotMousePress(false) | - | 
| 142 | , tlw(0) | - | 
| 143 | , m_platformSizeGrip(false) | - | 
| 144 | { | - | 
| 145 | } executed:  }Execution Count:215 | 215 | 
| 146 |  | - | 
| 147 | #ifdef Q_WS_MAC | - | 
| 148 | void QSizeGripPrivate::updateMacSizer(bool hide) const | - | 
| 149 | { | - | 
| 150 | Q_Q(const QSizeGrip); | - | 
| 151 | if (QApplication::closingDown() || !parent) | - | 
| 152 | return; | - | 
| 153 | QWidget *topLevelWindow = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q)); | - | 
| 154 | if(topLevelWindow && topLevelWindow->isWindow()) | - | 
| 155 | QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1); | - | 
| 156 | } | - | 
| 157 | #endif | - | 
| 158 |  | - | 
| 159 | Qt::Corner QSizeGripPrivate::corner() const | - | 
| 160 | { | - | 
| 161 | Q_Q(const QSizeGrip); executed (the execution status of this line is deduced):  const QSizeGrip * const q = q_func(); | - | 
| 162 | QWidget *tlw = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q)); executed (the execution status of this line is deduced):  QWidget *tlw = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q)); | - | 
| 163 | const QPoint sizeGripPos = q->mapTo(tlw, QPoint(0, 0)); executed (the execution status of this line is deduced):  const QPoint sizeGripPos = q->mapTo(tlw, QPoint(0, 0)); | - | 
| 164 | bool isAtBottom = sizeGripPos.y() >= tlw->height() / 2; executed (the execution status of this line is deduced):  bool isAtBottom = sizeGripPos.y() >= tlw->height() / 2; | - | 
| 165 | bool isAtLeft = sizeGripPos.x() <= tlw->width() / 2; executed (the execution status of this line is deduced):  bool isAtLeft = sizeGripPos.x() <= tlw->width() / 2; | - | 
| 166 | if (isAtLeft) evaluated:  isAtLeft| yes Evaluation Count:9 | yes Evaluation Count:61 | 
 | 9-61 | 
| 167 | return isAtBottom ? Qt::BottomLeftCorner : Qt::TopLeftCorner; executed:  return isAtBottom ? Qt::BottomLeftCorner : Qt::TopLeftCorner;Execution Count:9 | 9 | 
| 168 | else | - | 
| 169 | return isAtBottom ? Qt::BottomRightCorner : Qt::TopRightCorner; executed:  return isAtBottom ? Qt::BottomRightCorner : Qt::TopRightCorner;Execution Count:61 | 61 | 
| 170 | } | - | 
| 171 |  | - | 
| 172 | /*! | - | 
| 173 | \class QSizeGrip | - | 
| 174 |  | - | 
| 175 | \brief The QSizeGrip class provides a resize handle for resizing top-level windows. | - | 
| 176 |  | - | 
| 177 | \ingroup mainwindow-classes | - | 
| 178 | \ingroup basicwidgets | - | 
| 179 | \inmodule QtWidgets | - | 
| 180 |  | - | 
| 181 | This widget works like the standard Windows resize handle. In the | - | 
| 182 | X11 version this resize handle generally works differently from | - | 
| 183 | the one provided by the system if the X11 window manager does not | - | 
| 184 | support necessary modern post-ICCCM specifications. | - | 
| 185 |  | - | 
| 186 | Put this widget anywhere in a widget tree and the user can use it | - | 
| 187 | to resize the top-level window or any widget with the Qt::SubWindow | - | 
| 188 | flag set. Generally, this should be in the lower right-hand corner. | - | 
| 189 | Note that QStatusBar already uses this widget, so if you have a | - | 
| 190 | status bar (e.g., you are using QMainWindow), then you don't need | - | 
| 191 | to use this widget explicitly. | - | 
| 192 |  | - | 
| 193 | On some platforms the size grip automatically hides itself when the | - | 
| 194 | window is shown full screen or maximised. | - | 
| 195 |  | - | 
| 196 | \table 50% | - | 
| 197 | \row \li \inlineimage fusion-statusbar-sizegrip.png Screenshot of a Fusion style size grip | - | 
| 198 | \li A size grip widget at the bottom-right corner of a main window, shown in the | - | 
| 199 | \l{Fusion Style Widget Gallery}{Fusion widget style}. | - | 
| 200 | \endtable | - | 
| 201 |  | - | 
| 202 | The QSizeGrip class inherits QWidget and reimplements the \l | - | 
| 203 | {QWidget::mousePressEvent()}{mousePressEvent()} and \l | - | 
| 204 | {QWidget::mouseMoveEvent()}{mouseMoveEvent()} functions to feature | - | 
| 205 | the resize functionality, and the \l | - | 
| 206 | {QWidget::paintEvent()}{paintEvent()} function to render the | - | 
| 207 | size grip widget. | - | 
| 208 |  | - | 
| 209 | \sa QStatusBar, QWidget::windowState() | - | 
| 210 | */ | - | 
| 211 |  | - | 
| 212 |  | - | 
| 213 | /*! | - | 
| 214 | Constructs a resize corner as a child widget of  the given \a | - | 
| 215 | parent. | - | 
| 216 | */ | - | 
| 217 | QSizeGrip::QSizeGrip(QWidget * parent) | - | 
| 218 | : QWidget(*new QSizeGripPrivate, parent, 0) | - | 
| 219 | { | - | 
| 220 | Q_D(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 221 | d->init(); executed (the execution status of this line is deduced):  d->init(); | - | 
| 222 | } executed:  }Execution Count:215 | 215 | 
| 223 |  | - | 
| 224 |  | - | 
| 225 | void QSizeGripPrivate::init() | - | 
| 226 | { | - | 
| 227 | Q_Q(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGrip * const q = q_func(); | - | 
| 228 | m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner; partially evaluated:  q->isLeftToRight()| yes Evaluation Count:215 | no Evaluation Count:0 | 
 | 0-215 | 
| 229 |  | - | 
| 230 | #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC) | - | 
| 231 | q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner executed (the execution status of this line is deduced):  q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner | - | 
| 232 | ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); executed (the execution status of this line is deduced):  ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); | - | 
| 233 | #endif | - | 
| 234 | q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); executed (the execution status of this line is deduced):  q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); | - | 
| 235 | updateTopLevelWidget(); executed (the execution status of this line is deduced):  updateTopLevelWidget(); | - | 
| 236 | } executed:  }Execution Count:215 | 215 | 
| 237 |  | - | 
| 238 |  | - | 
| 239 | /*! | - | 
| 240 | Destroys this size grip. | - | 
| 241 | */ | - | 
| 242 | QSizeGrip::~QSizeGrip() | - | 
| 243 | { | - | 
| 244 | } | - | 
| 245 |  | - | 
| 246 | /*! | - | 
| 247 | \reimp | - | 
| 248 | */ | - | 
| 249 | QSize QSizeGrip::sizeHint() const | - | 
| 250 | { | - | 
| 251 | QStyleOption opt(0); executed (the execution status of this line is deduced):  QStyleOption opt(0); | - | 
| 252 | opt.init(this); executed (the execution status of this line is deduced):  opt.init(this); | - | 
| 253 | return (style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this). executed:  return (style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this). expandedTo(QApplication::globalStrut()));Execution Count:260 | 260 | 
| 254 | expandedTo(QApplication::globalStrut())); executed:  return (style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this). expandedTo(QApplication::globalStrut()));Execution Count:260 | 260 | 
| 255 | } | - | 
| 256 |  | - | 
| 257 | /*! | - | 
| 258 | Paints the resize grip. | - | 
| 259 |  | - | 
| 260 | Resize grips are usually rendered as small diagonal textured lines | - | 
| 261 | in the lower-right corner. The paint event is passed in the \a | - | 
| 262 | event parameter. | - | 
| 263 | */ | - | 
| 264 | void QSizeGrip::paintEvent(QPaintEvent *event) | - | 
| 265 | { | - | 
| 266 | Q_UNUSED(event); executed (the execution status of this line is deduced):  (void)event;; | - | 
| 267 | Q_D(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 268 | QPainter painter(this); executed (the execution status of this line is deduced):  QPainter painter(this); | - | 
| 269 | QStyleOptionSizeGrip opt; executed (the execution status of this line is deduced):  QStyleOptionSizeGrip opt; | - | 
| 270 | opt.init(this); executed (the execution status of this line is deduced):  opt.init(this); | - | 
| 271 | opt.corner = d->m_corner; executed (the execution status of this line is deduced):  opt.corner = d->m_corner; | - | 
| 272 | style()->drawControl(QStyle::CE_SizeGrip, &opt, &painter, this); executed (the execution status of this line is deduced):  style()->drawControl(QStyle::CE_SizeGrip, &opt, &painter, this); | - | 
| 273 | } executed:  }Execution Count:45 | 45 | 
| 274 |  | - | 
| 275 | /*! | - | 
| 276 | \fn void QSizeGrip::mousePressEvent(QMouseEvent * event) | - | 
| 277 |  | - | 
| 278 | Receives the mouse press events for the widget, and primes the | - | 
| 279 | resize operation. The mouse press event is passed in the \a event | - | 
| 280 | parameter. | - | 
| 281 | */ | - | 
| 282 |  | - | 
| 283 | void QSizeGrip::mousePressEvent(QMouseEvent * e) | - | 
| 284 | { | - | 
| 285 | if (e->button() != Qt::LeftButton) { never evaluated: e->button() != Qt::LeftButton | 0 | 
| 286 | QWidget::mousePressEvent(e); never executed (the execution status of this line is deduced):  QWidget::mousePressEvent(e); | - | 
| 287 | return; | 0 | 
| 288 | } | - | 
| 289 |  | - | 
| 290 | Q_D(QSizeGrip); never executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 291 | QWidget *tlw = qt_sizegrip_topLevelWidget(this); never executed (the execution status of this line is deduced):  QWidget *tlw = qt_sizegrip_topLevelWidget(this); | - | 
| 292 | d->p = e->globalPos(); never executed (the execution status of this line is deduced):  d->p = e->globalPos(); | - | 
| 293 | d->gotMousePress = true; never executed (the execution status of this line is deduced):  d->gotMousePress = true; | - | 
| 294 | d->r = tlw->geometry(); never executed (the execution status of this line is deduced):  d->r = tlw->geometry(); | - | 
| 295 |  | - | 
| 296 | // Does the platform provide size grip support? | - | 
| 297 | d->m_platformSizeGrip = false; never executed (the execution status of this line is deduced):  d->m_platformSizeGrip = false; | - | 
| 298 | if (tlw->isWindow() never evaluated: tlw->isWindow() | 0 | 
| 299 | && tlw->windowHandle() never evaluated: tlw->windowHandle() | 0 | 
| 300 | && !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint) never evaluated: !(tlw->windowFlags() & Qt::X11BypassWindowManagerHint) | 0 | 
| 301 | && !tlw->testAttribute(Qt::WA_DontShowOnScreen) never evaluated: !tlw->testAttribute(Qt::WA_DontShowOnScreen) | 0 | 
| 302 | && !tlw->hasHeightForWidth()) { never evaluated: !tlw->hasHeightForWidth() | 0 | 
| 303 | QPlatformWindow *platformWindow = tlw->windowHandle()->handle(); never executed (the execution status of this line is deduced):  QPlatformWindow *platformWindow = tlw->windowHandle()->handle(); | - | 
| 304 | const QPoint topLevelPos = mapTo(tlw, e->pos()); never executed (the execution status of this line is deduced):  const QPoint topLevelPos = mapTo(tlw, e->pos()); | - | 
| 305 | d->m_platformSizeGrip = platformWindow && platformWindow->startSystemResize(topLevelPos, d->m_corner); never evaluated: platformWindow never evaluated: platformWindow->startSystemResize(topLevelPos, d->m_corner) | 0 | 
| 306 | } | 0 | 
| 307 |  | - | 
| 308 | if (d->m_platformSizeGrip) never evaluated: d->m_platformSizeGrip | 0 | 
| 309 | return; | 0 | 
| 310 |  | - | 
| 311 | // Find available desktop/workspace geometry. | - | 
| 312 | QRect availableGeometry; never executed (the execution status of this line is deduced):  QRect availableGeometry; | - | 
| 313 | bool hasVerticalSizeConstraint = true; never executed (the execution status of this line is deduced):  bool hasVerticalSizeConstraint = true; | - | 
| 314 | bool hasHorizontalSizeConstraint = true; never executed (the execution status of this line is deduced):  bool hasHorizontalSizeConstraint = true; | - | 
| 315 | if (tlw->isWindow()) never evaluated: tlw->isWindow() | 0 | 
| 316 | availableGeometry = QApplication::desktop()->availableGeometry(tlw); never executed: availableGeometry = QApplication::desktop()->availableGeometry(tlw); | 0 | 
| 317 | else { | - | 
| 318 | const QWidget *tlwParent = tlw->parentWidget(); never executed (the execution status of this line is deduced):  const QWidget *tlwParent = tlw->parentWidget(); | - | 
| 319 | // Check if tlw is inside QAbstractScrollArea/QScrollArea. | - | 
| 320 | // If that's the case tlw->parentWidget() will return the viewport | - | 
| 321 | // and tlw->parentWidget()->parentWidget() will return the scroll area. | - | 
| 322 | #ifndef QT_NO_SCROLLAREA | - | 
| 323 | QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget()); never executed (the execution status of this line is deduced):  QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(tlwParent->parentWidget()); | - | 
| 324 | if (scrollArea) { never evaluated: scrollArea | 0 | 
| 325 | hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; never executed (the execution status of this line is deduced):  hasHorizontalSizeConstraint = scrollArea->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; | - | 
| 326 | hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; never executed (the execution status of this line is deduced):  hasVerticalSizeConstraint = scrollArea->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff; | - | 
| 327 | } | 0 | 
| 328 | #endif // QT_NO_SCROLLAREA | - | 
| 329 | availableGeometry = tlwParent->contentsRect(); never executed (the execution status of this line is deduced):  availableGeometry = tlwParent->contentsRect(); | - | 
| 330 | } | 0 | 
| 331 |  | - | 
| 332 | // Find frame geometries, title bar height, and decoration sizes. | - | 
| 333 | const QRect frameGeometry = tlw->frameGeometry(); never executed (the execution status of this line is deduced):  const QRect frameGeometry = tlw->frameGeometry(); | - | 
| 334 | const int titleBarHeight = qMax(tlw->geometry().y() - frameGeometry.y(), 0); never executed (the execution status of this line is deduced):  const int titleBarHeight = qMax(tlw->geometry().y() - frameGeometry.y(), 0); | - | 
| 335 | const int bottomDecoration = qMax(frameGeometry.height() - tlw->height() - titleBarHeight, 0); never executed (the execution status of this line is deduced):  const int bottomDecoration = qMax(frameGeometry.height() - tlw->height() - titleBarHeight, 0); | - | 
| 336 | const int leftRightDecoration = qMax((frameGeometry.width() - tlw->width()) / 2, 0); never executed (the execution status of this line is deduced):  const int leftRightDecoration = qMax((frameGeometry.width() - tlw->width()) / 2, 0); | - | 
| 337 |  | - | 
| 338 | // Determine dyMax depending on whether the sizegrip is at the bottom | - | 
| 339 | // of the widget or not. | - | 
| 340 | if (d->atBottom()) { never evaluated: d->atBottom() | 0 | 
| 341 | if (hasVerticalSizeConstraint) never evaluated: hasVerticalSizeConstraint | 0 | 
| 342 | d->dyMax = availableGeometry.bottom() - d->r.bottom() - bottomDecoration; never executed: d->dyMax = availableGeometry.bottom() - d->r.bottom() - bottomDecoration; | 0 | 
| 343 | else | - | 
| 344 | d->dyMax = INT_MAX; never executed: d->dyMax = 2147483647; | 0 | 
| 345 | } else { | - | 
| 346 | if (hasVerticalSizeConstraint) never evaluated: hasVerticalSizeConstraint | 0 | 
| 347 | d->dyMax = availableGeometry.y() - d->r.y() + titleBarHeight; never executed: d->dyMax = availableGeometry.y() - d->r.y() + titleBarHeight; | 0 | 
| 348 | else | - | 
| 349 | d->dyMax = -INT_MAX; never executed: d->dyMax = -2147483647; | 0 | 
| 350 | } | - | 
| 351 |  | - | 
| 352 | // In RTL mode, the size grip is to the left; find dxMax from the desktop/workspace | - | 
| 353 | // geometry, the size grip geometry and the width of the decoration. | - | 
| 354 | if (d->atLeft()) { never evaluated: d->atLeft() | 0 | 
| 355 | if (hasHorizontalSizeConstraint) never evaluated: hasHorizontalSizeConstraint | 0 | 
| 356 | d->dxMax = availableGeometry.x() - d->r.x() + leftRightDecoration; never executed: d->dxMax = availableGeometry.x() - d->r.x() + leftRightDecoration; | 0 | 
| 357 | else | - | 
| 358 | d->dxMax = -INT_MAX; never executed: d->dxMax = -2147483647; | 0 | 
| 359 | } else { | - | 
| 360 | if (hasHorizontalSizeConstraint) never evaluated: hasHorizontalSizeConstraint | 0 | 
| 361 | d->dxMax = availableGeometry.right() - d->r.right() - leftRightDecoration; never executed: d->dxMax = availableGeometry.right() - d->r.right() - leftRightDecoration; | 0 | 
| 362 | else | - | 
| 363 | d->dxMax = INT_MAX; never executed: d->dxMax = 2147483647; | 0 | 
| 364 | } | - | 
| 365 | } | - | 
| 366 |  | - | 
| 367 |  | - | 
| 368 | /*! | - | 
| 369 | \fn void QSizeGrip::mouseMoveEvent(QMouseEvent * event) | - | 
| 370 | Resizes the top-level widget containing this widget. The mouse | - | 
| 371 | move event is passed in the \a event parameter. | - | 
| 372 | */ | - | 
| 373 | void QSizeGrip::mouseMoveEvent(QMouseEvent * e) | - | 
| 374 | { | - | 
| 375 | Q_D(QSizeGrip); never executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 376 | if (e->buttons() != Qt::LeftButton || d->m_platformSizeGrip) { never evaluated: e->buttons() != Qt::LeftButton never evaluated: d->m_platformSizeGrip | 0 | 
| 377 | QWidget::mouseMoveEvent(e); never executed (the execution status of this line is deduced):  QWidget::mouseMoveEvent(e); | - | 
| 378 | return; | 0 | 
| 379 | } | - | 
| 380 |  | - | 
| 381 | QWidget* tlw = qt_sizegrip_topLevelWidget(this); never executed (the execution status of this line is deduced):  QWidget* tlw = qt_sizegrip_topLevelWidget(this); | - | 
| 382 | if (!d->gotMousePress || tlw->testAttribute(Qt::WA_WState_ConfigPending)) never evaluated: !d->gotMousePress never evaluated: tlw->testAttribute(Qt::WA_WState_ConfigPending) | 0 | 
| 383 | return; | 0 | 
| 384 |  | - | 
| 385 | QPoint np(e->globalPos()); never executed (the execution status of this line is deduced):  QPoint np(e->globalPos()); | - | 
| 386 |  | - | 
| 387 | // Don't extend beyond the available geometry; bound to dyMax and dxMax. | - | 
| 388 | QSize ns; never executed (the execution status of this line is deduced):  QSize ns; | - | 
| 389 | if (d->atBottom()) never evaluated: d->atBottom() | 0 | 
| 390 | ns.rheight() = d->r.height() + qMin(np.y() - d->p.y(), d->dyMax); never executed: ns.rheight() = d->r.height() + qMin(np.y() - d->p.y(), d->dyMax); | 0 | 
| 391 | else | - | 
| 392 | ns.rheight() = d->r.height() - qMax(np.y() - d->p.y(), d->dyMax); never executed: ns.rheight() = d->r.height() - qMax(np.y() - d->p.y(), d->dyMax); | 0 | 
| 393 |  | - | 
| 394 | if (d->atLeft()) never evaluated: d->atLeft() | 0 | 
| 395 | ns.rwidth() = d->r.width() - qMax(np.x() - d->p.x(), d->dxMax); never executed: ns.rwidth() = d->r.width() - qMax(np.x() - d->p.x(), d->dxMax); | 0 | 
| 396 | else | - | 
| 397 | ns.rwidth() = d->r.width() + qMin(np.x() - d->p.x(), d->dxMax); never executed: ns.rwidth() = d->r.width() + qMin(np.x() - d->p.x(), d->dxMax); | 0 | 
| 398 |  | - | 
| 399 | ns = QLayout::closestAcceptableSize(tlw, ns); never executed (the execution status of this line is deduced):  ns = QLayout::closestAcceptableSize(tlw, ns); | - | 
| 400 |  | - | 
| 401 | QPoint p; never executed (the execution status of this line is deduced):  QPoint p; | - | 
| 402 | QRect nr(p, ns); never executed (the execution status of this line is deduced):  QRect nr(p, ns); | - | 
| 403 | if (d->atBottom()) { never evaluated: d->atBottom() | 0 | 
| 404 | if (d->atLeft()) never evaluated: d->atLeft() | 0 | 
| 405 | nr.moveTopRight(d->r.topRight()); never executed: nr.moveTopRight(d->r.topRight()); | 0 | 
| 406 | else | - | 
| 407 | nr.moveTopLeft(d->r.topLeft()); never executed: nr.moveTopLeft(d->r.topLeft()); | 0 | 
| 408 | } else { | - | 
| 409 | if (d->atLeft()) never evaluated: d->atLeft() | 0 | 
| 410 | nr.moveBottomRight(d->r.bottomRight()); never executed: nr.moveBottomRight(d->r.bottomRight()); | 0 | 
| 411 | else | - | 
| 412 | nr.moveBottomLeft(d->r.bottomLeft()); never executed: nr.moveBottomLeft(d->r.bottomLeft()); | 0 | 
| 413 | } | - | 
| 414 |  | - | 
| 415 | tlw->setGeometry(nr); never executed (the execution status of this line is deduced):  tlw->setGeometry(nr); | - | 
| 416 | } | 0 | 
| 417 |  | - | 
| 418 | /*! | - | 
| 419 | \reimp | - | 
| 420 | */ | - | 
| 421 | void QSizeGrip::mouseReleaseEvent(QMouseEvent *mouseEvent) | - | 
| 422 | { | - | 
| 423 | if (mouseEvent->button() == Qt::LeftButton) { never evaluated: mouseEvent->button() == Qt::LeftButton | 0 | 
| 424 | Q_D(QSizeGrip); never executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 425 | d->gotMousePress = false; never executed (the execution status of this line is deduced):  d->gotMousePress = false; | - | 
| 426 | d->p = QPoint(); never executed (the execution status of this line is deduced):  d->p = QPoint(); | - | 
| 427 | } else { | 0 | 
| 428 | QWidget::mouseReleaseEvent(mouseEvent); never executed (the execution status of this line is deduced):  QWidget::mouseReleaseEvent(mouseEvent); | - | 
| 429 | } | 0 | 
| 430 | } | - | 
| 431 |  | - | 
| 432 | /*! | - | 
| 433 | \reimp | - | 
| 434 | */ | - | 
| 435 | void QSizeGrip::moveEvent(QMoveEvent * /*moveEvent*/) | - | 
| 436 | { | - | 
| 437 | Q_D(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 438 | // We're inside a resize operation; no update necessary. | - | 
| 439 | if (!d->p.isNull()) partially evaluated:  !d->p.isNull()| no Evaluation Count:0 | yes Evaluation Count:70 | 
 | 0-70 | 
| 440 | return; | 0 | 
| 441 |  | - | 
| 442 | d->m_corner = d->corner(); executed (the execution status of this line is deduced):  d->m_corner = d->corner(); | - | 
| 443 | #if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC) | - | 
| 444 | setCursor(d->m_corner == Qt::TopLeftCorner || d->m_corner == Qt::BottomRightCorner executed (the execution status of this line is deduced):  setCursor(d->m_corner == Qt::TopLeftCorner || d->m_corner == Qt::BottomRightCorner | - | 
| 445 | ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); executed (the execution status of this line is deduced):  ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); | - | 
| 446 | #endif | - | 
| 447 | } executed:  }Execution Count:70 | 70 | 
| 448 |  | - | 
| 449 | /*! | - | 
| 450 | \reimp | - | 
| 451 | */ | - | 
| 452 | void QSizeGrip::showEvent(QShowEvent *showEvent) | - | 
| 453 | { | - | 
| 454 | #ifdef Q_WS_MAC | - | 
| 455 | d_func()->updateMacSizer(false); | - | 
| 456 | #endif | - | 
| 457 | QWidget::showEvent(showEvent); executed (the execution status of this line is deduced):  QWidget::showEvent(showEvent); | - | 
| 458 | } executed:  }Execution Count:66 | 66 | 
| 459 |  | - | 
| 460 | /*! | - | 
| 461 | \reimp | - | 
| 462 | */ | - | 
| 463 | void QSizeGrip::hideEvent(QHideEvent *hideEvent) | - | 
| 464 | { | - | 
| 465 | #ifdef Q_WS_MAC | - | 
| 466 | d_func()->updateMacSizer(true); | - | 
| 467 | #endif | - | 
| 468 | QWidget::hideEvent(hideEvent); executed (the execution status of this line is deduced):  QWidget::hideEvent(hideEvent); | - | 
| 469 | } executed:  }Execution Count:64 | 64 | 
| 470 |  | - | 
| 471 | /*! | - | 
| 472 | \reimp | - | 
| 473 | */ | - | 
| 474 | void QSizeGrip::setVisible(bool visible) | - | 
| 475 | { | - | 
| 476 | QWidget::setVisible(visible); executed (the execution status of this line is deduced):  QWidget::setVisible(visible); | - | 
| 477 | } executed:  }Execution Count:243 | 243 | 
| 478 |  | - | 
| 479 | /*! \reimp */ | - | 
| 480 | bool QSizeGrip::eventFilter(QObject *o, QEvent *e) | - | 
| 481 | { | - | 
| 482 | Q_D(QSizeGrip); executed (the execution status of this line is deduced):  QSizeGripPrivate * const d = d_func(); | - | 
| 483 | if ((isHidden() && testAttribute(Qt::WA_WState_ExplicitShowHide)) evaluated:  isHidden()| yes Evaluation Count:569 | yes Evaluation Count:9896 | 
 evaluated:  testAttribute(Qt::WA_WState_ExplicitShowHide)| yes Evaluation Count:495 | yes Evaluation Count:74 | 
 | 74-9896 | 
| 484 | || e->type() != QEvent::WindowStateChange evaluated:  e->type() != QEvent::WindowStateChange| yes Evaluation Count:9953 | yes Evaluation Count:17 | 
 | 17-9953 | 
| 485 | || o != d->tlw) { partially evaluated:  o != d->tlw| no Evaluation Count:0 | yes Evaluation Count:17 | 
 | 0-17 | 
| 486 | return QWidget::eventFilter(o, e); executed:  return QWidget::eventFilter(o, e);Execution Count:10448 | 10448 | 
| 487 | } | - | 
| 488 | Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; executed (the execution status of this line is deduced):  Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; | - | 
| 489 | #ifndef Q_WS_MAC | - | 
| 490 | sizeGripNotVisibleState |= Qt::WindowMaximized; executed (the execution status of this line is deduced):  sizeGripNotVisibleState |= Qt::WindowMaximized; | - | 
| 491 | #endif | - | 
| 492 | // Don't show the size grip if the tlw is maximized or in full screen mode. | - | 
| 493 | setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState)); executed (the execution status of this line is deduced):  setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState)); | - | 
| 494 | setAttribute(Qt::WA_WState_ExplicitShowHide, false); executed (the execution status of this line is deduced):  setAttribute(Qt::WA_WState_ExplicitShowHide, false); | - | 
| 495 | return QWidget::eventFilter(o, e); executed:  return QWidget::eventFilter(o, e);Execution Count:17 | 17 | 
| 496 | } | - | 
| 497 |  | - | 
| 498 | /*! | - | 
| 499 | \reimp | - | 
| 500 | */ | - | 
| 501 | bool QSizeGrip::event(QEvent *event) | - | 
| 502 | { | - | 
| 503 | return QWidget::event(event); executed:  return QWidget::event(event);Execution Count:1275 | 1275 | 
| 504 | } | - | 
| 505 |  | - | 
| 506 | QT_END_NAMESPACE | - | 
| 507 |  | - | 
| 508 | #include "moc_qsizegrip.cpp" | - | 
| 509 |  | - | 
| 510 | #endif //QT_NO_SIZEGRIP | - | 
| 511 |  | - | 
|  |  |  |