| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) | - |
| 13 | : QGraphicsObject(*new QGraphicsWidgetPrivate, 0), QGraphicsLayoutItem(0, false) | - |
| 14 | { | - |
| 15 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 16 | d->init(parent, wFlags); | - |
| 17 | } executed: }Execution Count:1436 | 1436 |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, Qt::WindowFlags wFlags) | - |
| 25 | : QGraphicsObject(dd, 0), QGraphicsLayoutItem(0, false) | - |
| 26 | { | - |
| 27 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 28 | d->init(parent, wFlags); | - |
| 29 | } executed: }Execution Count:8 | 8 |
| 30 | class QGraphicsWidgetStyles | - |
| 31 | { | - |
| 32 | public: | - |
| 33 | QStyle *styleForWidget(const QGraphicsWidget *widget) const | - |
| 34 | { | - |
| 35 | QMutexLocker locker(&mutex); | - |
| 36 | return styles.value(widget, 0); executed: return styles.value(widget, 0);Execution Count:3349 | 3349 |
| 37 | } | - |
| 38 | | - |
| 39 | void setStyleForWidget(QGraphicsWidget *widget, QStyle *style) | - |
| 40 | { | - |
| 41 | QMutexLocker locker(&mutex); | - |
| 42 | if (style) partially evaluated: style| no Evaluation Count:0 | yes Evaluation Count:936 |
| 0-936 |
| 43 | styles[widget] = style; never executed: styles[widget] = style; | 0 |
| 44 | else | - |
| 45 | styles.remove(widget); executed: styles.remove(widget);Execution Count:936 | 936 |
| 46 | } | - |
| 47 | | - |
| 48 | private: | - |
| 49 | QHash<const QGraphicsWidget *, QStyle *> styles; | - |
| 50 | mutable QMutex mutex; | - |
| 51 | }; | - |
| 52 | static QGraphicsWidgetStyles *widgetStyles() { static QGlobalStatic<QGraphicsWidgetStyles > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QGraphicsWidgetStyles *x = new QGraphicsWidgetStyles; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QGraphicsWidgetStyles > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:6 | yes Evaluation Count:4279 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:6 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:4285 | 0-4285 |
| 53 | | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | QGraphicsWidget::~QGraphicsWidget() | - |
| 58 | { | - |
| 59 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 60 | | - |
| 61 | | - |
| 62 | for (int i = 0; i < d->actions.size(); ++i) { partially evaluated: i < d->actions.size()| no Evaluation Count:0 | yes Evaluation Count:936 |
| 0-936 |
| 63 | QActionPrivate *apriv = d->actions.at(i)->d_func(); | - |
| 64 | apriv->graphicsWidgets.removeAll(this); | - |
| 65 | } | 0 |
| 66 | d->actions.clear(); | - |
| 67 | | - |
| 68 | | - |
| 69 | if (QGraphicsScene *scn = scene()) { evaluated: QGraphicsScene *scn = scene()| yes Evaluation Count:920 | yes Evaluation Count:16 |
| 16-920 |
| 70 | QGraphicsScenePrivate *sceneD = scn->d_func(); | - |
| 71 | if (sceneD->tabFocusFirst == this) evaluated: sceneD->tabFocusFirst == this| yes Evaluation Count:910 | yes Evaluation Count:10 |
| 10-910 |
| 72 | sceneD->tabFocusFirst = (d->focusNext == this ? 0 : d->focusNext); evaluated: d->focusNext == this| yes Evaluation Count:192 | yes Evaluation Count:718 |
executed: sceneD->tabFocusFirst = (d->focusNext == this ? 0 : d->focusNext);Execution Count:910 | 192-910 |
| 73 | } executed: }Execution Count:920 | 920 |
| 74 | d->focusPrev->d_func()->focusNext = d->focusNext; | - |
| 75 | d->focusNext->d_func()->focusPrev = d->focusPrev; | - |
| 76 | | - |
| 77 | | - |
| 78 | d->focusNext = this; | - |
| 79 | d->focusPrev = this; | - |
| 80 | | - |
| 81 | clearFocus(); | - |
| 82 | | - |
| 83 | | - |
| 84 | if (d->layout) { evaluated: d->layout| yes Evaluation Count:187 | yes Evaluation Count:749 |
| 187-749 |
| 85 | QGraphicsLayout *temp = d->layout; | - |
| 86 | for (QForeachContainer<__typeof__(childItems())> _container_(childItems()); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QGraphicsItem * item = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | if (item->isWidget()) { evaluated: item->isWidget()| yes Evaluation Count:690 | yes Evaluation Count:3 |
| 3-690 |
| 91 | QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); | - |
| 92 | if (widget->parentLayoutItem() == d->layout) evaluated: widget->parentLayoutItem() == d->layout| yes Evaluation Count:613 | yes Evaluation Count:77 |
| 77-613 |
| 93 | widget->setParentLayoutItem(0); executed: widget->setParentLayoutItem(0);Execution Count:613 | 613 |
| 94 | } executed: }Execution Count:690 | 690 |
| 95 | } executed: }Execution Count:693 | 693 |
| 96 | d->layout = 0; | - |
| 97 | delete temp; | - |
| 98 | } executed: }Execution Count:187 | 187 |
| 99 | | - |
| 100 | | - |
| 101 | widgetStyles()->setStyleForWidget(this, 0); | - |
| 102 | } executed: }Execution Count:936 | 936 |
| 103 | QSizeF QGraphicsWidget::size() const | - |
| 104 | { | - |
| 105 | return QGraphicsLayoutItem::geometry().size(); executed: return QGraphicsLayoutItem::geometry().size();Execution Count:8515 | 8515 |
| 106 | } | - |
| 107 | | - |
| 108 | void QGraphicsWidget::resize(const QSizeF &size) | - |
| 109 | { | - |
| 110 | setGeometry(QRectF(pos(), size)); | - |
| 111 | } executed: }Execution Count:3247 | 3247 |
| 112 | void QGraphicsWidget::setGeometry(const QRectF &rect) | - |
| 113 | { | - |
| 114 | QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func(); | - |
| 115 | QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data(); | - |
| 116 | QRectF newGeom; | - |
| 117 | QPointF oldPos = d->geom.topLeft(); | - |
| 118 | if (!wd->inSetPos) { evaluated: !wd->inSetPos| yes Evaluation Count:4379 | yes Evaluation Count:1 |
| 1-4379 |
| 119 | setAttribute(Qt::WA_Resized); | - |
| 120 | newGeom = rect; | - |
| 121 | newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) | - |
| 122 | .boundedTo(effectiveSizeHint(Qt::MaximumSize))); | - |
| 123 | | - |
| 124 | if (newGeom == d->geom) { evaluated: newGeom == d->geom| yes Evaluation Count:2412 | yes Evaluation Count:1967 |
| 1967-2412 |
| 125 | goto relayoutChildrenAndReturn; executed: goto relayoutChildrenAndReturn;Execution Count:2412 | 2412 |
| 126 | } | - |
| 127 | | - |
| 128 | | - |
| 129 | wd->inSetGeometry = 1; | - |
| 130 | setPos(newGeom.topLeft()); | - |
| 131 | wd->inSetGeometry = 0; | - |
| 132 | newGeom.moveTopLeft(pos()); | - |
| 133 | | - |
| 134 | if (newGeom == d->geom) { partially evaluated: newGeom == d->geom| no Evaluation Count:0 | yes Evaluation Count:1967 |
| 0-1967 |
| 135 | goto relayoutChildrenAndReturn; never executed: goto relayoutChildrenAndReturn; | 0 |
| 136 | } | - |
| 137 | | - |
| 138 | | - |
| 139 | if (wd->scene) { evaluated: wd->scene| yes Evaluation Count:1340 | yes Evaluation Count:627 |
| 627-1340 |
| 140 | if (rect.topLeft() == d->geom.topLeft()) { evaluated: rect.topLeft() == d->geom.topLeft()| yes Evaluation Count:613 | yes Evaluation Count:727 |
| 613-727 |
| 141 | prepareGeometryChange(); | - |
| 142 | } executed: }Execution Count:613 | 613 |
| 143 | } executed: }Execution Count:1340 | 1340 |
| 144 | } executed: }Execution Count:1967 | 1967 |
| 145 | | - |
| 146 | | - |
| 147 | { | - |
| 148 | bool moved = oldPos != pos(); | - |
| 149 | if (moved) { evaluated: moved| yes Evaluation Count:753 | yes Evaluation Count:1215 |
| 753-1215 |
| 150 | | - |
| 151 | QGraphicsSceneMoveEvent event; | - |
| 152 | event.setOldPos(oldPos); | - |
| 153 | event.setNewPos(pos()); | - |
| 154 | QApplication::sendEvent(this, &event); | - |
| 155 | if (wd->inSetPos) { evaluated: wd->inSetPos| yes Evaluation Count:1 | yes Evaluation Count:752 |
| 1-752 |
| 156 | | - |
| 157 | d->geom.moveTopLeft(pos()); | - |
| 158 | geometryChanged(); | - |
| 159 | goto relayoutChildrenAndReturn; executed: goto relayoutChildrenAndReturn;Execution Count:1 | 1 |
| 160 | } | - |
| 161 | } executed: }Execution Count:752 | 752 |
| 162 | QSizeF oldSize = size(); | - |
| 163 | QGraphicsLayoutItem::setGeometry(newGeom); | - |
| 164 | | - |
| 165 | bool resized = newGeom.size() != oldSize; | - |
| 166 | if (resized) { evaluated: resized| yes Evaluation Count:1746 | yes Evaluation Count:221 |
| 221-1746 |
| 167 | QGraphicsSceneResizeEvent re; | - |
| 168 | re.setOldSize(oldSize); | - |
| 169 | re.setNewSize(newGeom.size()); | - |
| 170 | if (oldSize.width() != newGeom.size().width()) evaluated: oldSize.width() != newGeom.size().width()| yes Evaluation Count:1678 | yes Evaluation Count:68 |
| 68-1678 |
| 171 | widthChanged(); executed: widthChanged();Execution Count:1678 | 1678 |
| 172 | if (oldSize.height() != newGeom.size().height()) evaluated: oldSize.height() != newGeom.size().height()| yes Evaluation Count:1622 | yes Evaluation Count:124 |
| 124-1622 |
| 173 | heightChanged(); executed: heightChanged();Execution Count:1622 | 1622 |
| 174 | QGraphicsLayout *lay = wd->layout; | - |
| 175 | if (QGraphicsLayout::instantInvalidatePropagation()) { evaluated: QGraphicsLayout::instantInvalidatePropagation()| yes Evaluation Count:28 | yes Evaluation Count:1718 |
| 28-1718 |
| 176 | if (!lay || lay->isActivated()) { evaluated: !lay| yes Evaluation Count:12 | yes Evaluation Count:16 |
evaluated: lay->isActivated()| yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8-16 |
| 177 | QApplication::sendEvent(this, &re); | - |
| 178 | } executed: }Execution Count:20 | 20 |
| 179 | } else { executed: }Execution Count:28 | 28 |
| 180 | QApplication::sendEvent(this, &re); | - |
| 181 | } executed: }Execution Count:1718 | 1718 |
| 182 | } | - |
| 183 | } | - |
| 184 | | - |
| 185 | geometryChanged(); | - |
| 186 | relayoutChildrenAndReturn: code before this statement executed: relayoutChildrenAndReturn:Execution Count:1967 | 1967 |
| 187 | if (QGraphicsLayout::instantInvalidatePropagation()) { evaluated: QGraphicsLayout::instantInvalidatePropagation()| yes Evaluation Count:52 | yes Evaluation Count:4328 |
| 52-4328 |
| 188 | if (QGraphicsLayout *lay = wd->layout) { evaluated: QGraphicsLayout *lay = wd->layout| yes Evaluation Count:34 | yes Evaluation Count:18 |
| 18-34 |
| 189 | if (!lay->isActivated()) { evaluated: !lay->isActivated()| yes Evaluation Count:12 | yes Evaluation Count:22 |
| 12-22 |
| 190 | QEvent layoutRequest(QEvent::LayoutRequest); | - |
| 191 | QApplication::sendEvent(this, &layoutRequest); | - |
| 192 | } executed: }Execution Count:12 | 12 |
| 193 | } executed: }Execution Count:34 | 34 |
| 194 | } executed: }Execution Count:52 | 52 |
| 195 | } executed: }Execution Count:4380 | 4380 |
| 196 | void QGraphicsWidget::setContentsMargins(qreal left, qreal top, qreal right, qreal bottom) | - |
| 197 | { | - |
| 198 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 199 | | - |
| 200 | if (!d->margins && left == 0 && top == 0 && right == 0 && bottom == 0) partially evaluated: !d->margins| yes Evaluation Count:86 | no Evaluation Count:0 |
evaluated: left == 0| yes Evaluation Count:85 | yes Evaluation Count:1 |
partially evaluated: top == 0| yes Evaluation Count:85 | no Evaluation Count:0 |
partially evaluated: right == 0| yes Evaluation Count:85 | no Evaluation Count:0 |
partially evaluated: bottom == 0| yes Evaluation Count:85 | no Evaluation Count:0 |
| 0-86 |
| 201 | return; executed: return;Execution Count:85 | 85 |
| 202 | d->ensureMargins(); | - |
| 203 | if (left == d->margins[d->Left] partially evaluated: left == d->margins[d->Left]| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 204 | && top == d->margins[d->Top] never evaluated: top == d->margins[d->Top] | 0 |
| 205 | && right == d->margins[d->Right] never evaluated: right == d->margins[d->Right] | 0 |
| 206 | && bottom == d->margins[d->Bottom]) never evaluated: bottom == d->margins[d->Bottom] | 0 |
| 207 | return; | 0 |
| 208 | | - |
| 209 | d->margins[d->Left] = left; | - |
| 210 | d->margins[d->Top] = top; | - |
| 211 | d->margins[d->Right] = right; | - |
| 212 | d->margins[d->Bottom] = bottom; | - |
| 213 | | - |
| 214 | if (QGraphicsLayout *l = d->layout) partially evaluated: QGraphicsLayout *l = d->layout| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 215 | l->invalidate(); never executed: l->invalidate(); | 0 |
| 216 | else | - |
| 217 | updateGeometry(); executed: updateGeometry();Execution Count:1 | 1 |
| 218 | | - |
| 219 | QEvent e(QEvent::ContentsRectChange); | - |
| 220 | QApplication::sendEvent(this, &e); | - |
| 221 | } executed: }Execution Count:1 | 1 |
| 222 | void QGraphicsWidget::getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const | - |
| 223 | { | - |
| 224 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 225 | if (left || top || right || bottom) partially evaluated: left| yes Evaluation Count:368 | no Evaluation Count:0 |
| 0-368 |
| 226 | d->ensureMargins(); executed: d->ensureMargins();Execution Count:368 | 368 |
| 227 | if (left) partially evaluated: left| yes Evaluation Count:368 | no Evaluation Count:0 |
| 0-368 |
| 228 | *left = d->margins[d->Left]; executed: *left = d->margins[d->Left];Execution Count:368 | 368 |
| 229 | if (top) partially evaluated: top| yes Evaluation Count:368 | no Evaluation Count:0 |
| 0-368 |
| 230 | *top = d->margins[d->Top]; executed: *top = d->margins[d->Top];Execution Count:368 | 368 |
| 231 | if (right) partially evaluated: right| yes Evaluation Count:368 | no Evaluation Count:0 |
| 0-368 |
| 232 | *right = d->margins[d->Right]; executed: *right = d->margins[d->Right];Execution Count:368 | 368 |
| 233 | if (bottom) partially evaluated: bottom| yes Evaluation Count:368 | no Evaluation Count:0 |
| 0-368 |
| 234 | *bottom = d->margins[d->Bottom]; executed: *bottom = d->margins[d->Bottom];Execution Count:368 | 368 |
| 235 | } executed: }Execution Count:368 | 368 |
| 236 | void QGraphicsWidget::setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom) | - |
| 237 | { | - |
| 238 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 239 | | - |
| 240 | if (!d->windowFrameMargins && left == 0 && top == 0 && right == 0 && bottom == 0) partially evaluated: !d->windowFrameMargins| yes Evaluation Count:1445 | no Evaluation Count:0 |
evaluated: left == 0| yes Evaluation Count:1260 | yes Evaluation Count:185 |
partially evaluated: top == 0| yes Evaluation Count:1260 | no Evaluation Count:0 |
partially evaluated: right == 0| yes Evaluation Count:1260 | no Evaluation Count:0 |
partially evaluated: bottom == 0| yes Evaluation Count:1260 | no Evaluation Count:0 |
| 0-1445 |
| 241 | return; executed: return;Execution Count:1260 | 1260 |
| 242 | d->ensureWindowFrameMargins(); | - |
| 243 | bool unchanged = | - |
| 244 | d->windowFrameMargins[d->Left] == left partially evaluated: d->windowFrameMargins[d->Left] == left| no Evaluation Count:0 | yes Evaluation Count:185 |
| 0-185 |
| 245 | && d->windowFrameMargins[d->Top] == top never evaluated: d->windowFrameMargins[d->Top] == top | 0 |
| 246 | && d->windowFrameMargins[d->Right] == right never evaluated: d->windowFrameMargins[d->Right] == right | 0 |
| 247 | && d->windowFrameMargins[d->Bottom] == bottom; never evaluated: d->windowFrameMargins[d->Bottom] == bottom | 0 |
| 248 | if (d->setWindowFrameMargins && unchanged) partially evaluated: d->setWindowFrameMargins| no Evaluation Count:0 | yes Evaluation Count:185 |
never evaluated: unchanged | 0-185 |
| 249 | return; | 0 |
| 250 | if (!unchanged) partially evaluated: !unchanged| yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-185 |
| 251 | prepareGeometryChange(); executed: prepareGeometryChange();Execution Count:185 | 185 |
| 252 | d->windowFrameMargins[d->Left] = left; | - |
| 253 | d->windowFrameMargins[d->Top] = top; | - |
| 254 | d->windowFrameMargins[d->Right] = right; | - |
| 255 | d->windowFrameMargins[d->Bottom] = bottom; | - |
| 256 | d->setWindowFrameMargins = true; | - |
| 257 | } executed: }Execution Count:185 | 185 |
| 258 | void QGraphicsWidget::getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const | - |
| 259 | { | - |
| 260 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 261 | if (left || top || right || bottom) | 0 |
| 262 | d->ensureWindowFrameMargins(); never executed: d->ensureWindowFrameMargins(); | 0 |
| 263 | if (left) | 0 |
| 264 | *left = d->windowFrameMargins[d->Left]; never executed: *left = d->windowFrameMargins[d->Left]; | 0 |
| 265 | if (top) | 0 |
| 266 | *top = d->windowFrameMargins[d->Top]; never executed: *top = d->windowFrameMargins[d->Top]; | 0 |
| 267 | if (right) | 0 |
| 268 | *right = d->windowFrameMargins[d->Right]; never executed: *right = d->windowFrameMargins[d->Right]; | 0 |
| 269 | if (bottom) | 0 |
| 270 | *bottom = d->windowFrameMargins[d->Bottom]; never executed: *bottom = d->windowFrameMargins[d->Bottom]; | 0 |
| 271 | } | 0 |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | | - |
| 278 | void QGraphicsWidget::unsetWindowFrameMargins() | - |
| 279 | { | - |
| 280 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 281 | if ((d->windowFlags & Qt::Window) && (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup && evaluated: (d->windowFlags & Qt::Window)| yes Evaluation Count:185 | yes Evaluation Count:1260 |
partially evaluated: (d->windowFlags & Qt::WindowType_Mask) != Qt::Popup| yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-1260 |
| 282 | (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip && !(d->windowFlags & Qt::FramelessWindowHint)) { partially evaluated: (d->windowFlags & Qt::WindowType_Mask) != Qt::ToolTip| yes Evaluation Count:185 | no Evaluation Count:0 |
partially evaluated: !(d->windowFlags & Qt::FramelessWindowHint)| yes Evaluation Count:185 | no Evaluation Count:0 |
| 0-185 |
| 283 | QStyleOptionTitleBar bar; | - |
| 284 | d->initStyleOptionTitleBar(&bar); | - |
| 285 | QStyle *style = this->style(); | - |
| 286 | qreal margin = style->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth); | - |
| 287 | qreal titleBarHeight = d->titleBarHeight(bar); | - |
| 288 | setWindowFrameMargins(margin, titleBarHeight, margin, margin); | - |
| 289 | } else { executed: }Execution Count:185 | 185 |
| 290 | setWindowFrameMargins(0, 0, 0, 0); | - |
| 291 | } executed: }Execution Count:1260 | 1260 |
| 292 | d->setWindowFrameMargins = false; | - |
| 293 | } executed: }Execution Count:1445 | 1445 |
| 294 | | - |
| 295 | | - |
| 296 | | - |
| 297 | | - |
| 298 | | - |
| 299 | | - |
| 300 | | - |
| 301 | QRectF QGraphicsWidget::windowFrameGeometry() const | - |
| 302 | { | - |
| 303 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 304 | return d->windowFrameMargins | 28 |
| 305 | ? geometry().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], | 28 |
| 306 | d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) | 28 |
| 307 | : geometry(); executed: return d->windowFrameMargins ? geometry().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) : geometry();Execution Count:28 | 28 |
| 308 | } | - |
| 309 | | - |
| 310 | | - |
| 311 | | - |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | QRectF QGraphicsWidget::windowFrameRect() const | - |
| 316 | { | - |
| 317 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 318 | return d->windowFrameMargins | 2890 |
| 319 | ? rect().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], | 2890 |
| 320 | d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) | 2890 |
| 321 | : rect(); executed: return d->windowFrameMargins ? rect().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) : rect();Execution Count:2890 | 2890 |
| 322 | } | - |
| 323 | void QGraphicsWidget::initStyleOption(QStyleOption *option) const | - |
| 324 | { | - |
| 325 | qt_noop(); | - |
| 326 | | - |
| 327 | option->state = QStyle::State_None; | - |
| 328 | if (isEnabled()) partially evaluated: isEnabled()| yes Evaluation Count:241 | no Evaluation Count:0 |
| 0-241 |
| 329 | option->state |= QStyle::State_Enabled; executed: option->state |= QStyle::State_Enabled;Execution Count:241 | 241 |
| 330 | if (hasFocus()) partially evaluated: hasFocus()| no Evaluation Count:0 | yes Evaluation Count:241 |
| 0-241 |
| 331 | option->state |= QStyle::State_HasFocus; never executed: option->state |= QStyle::State_HasFocus; | 0 |
| 332 | | - |
| 333 | | - |
| 334 | if (isUnderMouse()) evaluated: isUnderMouse()| yes Evaluation Count:12 | yes Evaluation Count:229 |
| 12-229 |
| 335 | option->state |= QStyle::State_MouseOver; executed: option->state |= QStyle::State_MouseOver;Execution Count:12 | 12 |
| 336 | if (QGraphicsWidget *w = window()) { evaluated: QGraphicsWidget *w = window()| yes Evaluation Count:56 | yes Evaluation Count:185 |
| 56-185 |
| 337 | if (w->isActiveWindow()) evaluated: w->isActiveWindow()| yes Evaluation Count:32 | yes Evaluation Count:24 |
| 24-32 |
| 338 | option->state |= QStyle::State_Active; executed: option->state |= QStyle::State_Active;Execution Count:32 | 32 |
| 339 | } executed: }Execution Count:56 | 56 |
| 340 | if (isWindow()) partially evaluated: isWindow()| yes Evaluation Count:241 | no Evaluation Count:0 |
| 0-241 |
| 341 | option->state |= QStyle::State_Window; executed: option->state |= QStyle::State_Window;Execution Count:241 | 241 |
| 342 | option->direction = layoutDirection(); | - |
| 343 | option->rect = rect().toRect(); | - |
| 344 | option->palette = palette(); | - |
| 345 | if (!isEnabled()) { partially evaluated: !isEnabled()| no Evaluation Count:0 | yes Evaluation Count:241 |
| 0-241 |
| 346 | option->palette.setCurrentColorGroup(QPalette::Disabled); | - |
| 347 | } else if (isActiveWindow()) { evaluated: isActiveWindow()| yes Evaluation Count:32 | yes Evaluation Count:209 |
| 0-209 |
| 348 | option->palette.setCurrentColorGroup(QPalette::Active); | - |
| 349 | } else { executed: }Execution Count:32 | 32 |
| 350 | option->palette.setCurrentColorGroup(QPalette::Inactive); | - |
| 351 | } executed: }Execution Count:209 | 209 |
| 352 | option->fontMetrics = QFontMetrics(font()); | - |
| 353 | option->styleObject = const_cast<QGraphicsWidget *>(this); | - |
| 354 | } executed: }Execution Count:241 | 241 |
| 355 | | - |
| 356 | | - |
| 357 | | - |
| 358 | | - |
| 359 | QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const | - |
| 360 | { | - |
| 361 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 362 | QSizeF sh; | - |
| 363 | if (d->layout) { evaluated: d->layout| yes Evaluation Count:1210 | yes Evaluation Count:4610 |
| 1210-4610 |
| 364 | QSizeF marginSize(0,0); | - |
| 365 | if (d->margins) { evaluated: d->margins| yes Evaluation Count:769 | yes Evaluation Count:441 |
| 441-769 |
| 366 | marginSize = QSizeF(d->margins[d->Left] + d->margins[d->Right], | - |
| 367 | d->margins[d->Top] + d->margins[d->Bottom]); | - |
| 368 | } executed: }Execution Count:769 | 769 |
| 369 | sh = d->layout->effectiveSizeHint(which, constraint - marginSize); | - |
| 370 | sh += marginSize; | - |
| 371 | } else { executed: }Execution Count:1210 | 1210 |
| 372 | switch (which) { | - |
| 373 | case Qt::MinimumSize: | - |
| 374 | sh = QSizeF(0, 0); | - |
| 375 | break; executed: break;Execution Count:898 | 898 |
| 376 | case Qt::PreferredSize: | - |
| 377 | sh = QSizeF(50, 50); | - |
| 378 | break; executed: break;Execution Count:1503 | 1503 |
| 379 | case Qt::MaximumSize: | - |
| 380 | sh = QSizeF(((1<<24)-1), ((1<<24)-1)); | - |
| 381 | break; executed: break;Execution Count:2209 | 2209 |
| 382 | default: | - |
| 383 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 767, __PRETTY_FUNCTION__).warning("QGraphicsWidget::sizeHint(): Don't know how to handle the value of 'which'"); | - |
| 384 | break; | 0 |
| 385 | } | - |
| 386 | } executed: }Execution Count:4610 | 4610 |
| 387 | return sh; executed: return sh;Execution Count:5820 | 5820 |
| 388 | } | - |
| 389 | QGraphicsLayout *QGraphicsWidget::layout() const | - |
| 390 | { | - |
| 391 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 392 | return d->layout; executed: return d->layout;Execution Count:7970 | 7970 |
| 393 | } | - |
| 394 | void QGraphicsWidget::setLayout(QGraphicsLayout *l) | - |
| 395 | { | - |
| 396 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 397 | if (d->layout == l) evaluated: d->layout == l| yes Evaluation Count:4 | yes Evaluation Count:194 |
| 4-194 |
| 398 | return; executed: return;Execution Count:4 | 4 |
| 399 | d->setLayout_helper(l); | - |
| 400 | if (!l) evaluated: !l| yes Evaluation Count:7 | yes Evaluation Count:187 |
| 7-187 |
| 401 | return; executed: return;Execution Count:7 | 7 |
| 402 | | - |
| 403 | | - |
| 404 | QGraphicsLayoutItem *oldParent = l->parentLayoutItem(); | - |
| 405 | if (oldParent && oldParent != this) { partially evaluated: oldParent| no Evaluation Count:0 | yes Evaluation Count:187 |
never evaluated: oldParent != this | 0-187 |
| 406 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 844, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setLayout: Attempting to set a layout on %s" | - |
| 407 | " \"%s\", when the layout already has a parent", | - |
| 408 | metaObject()->className(), QString(objectName()).toLocal8Bit().constData()); | - |
| 409 | return; | 0 |
| 410 | } | - |
| 411 | | - |
| 412 | | - |
| 413 | l->setParentLayoutItem(this); | - |
| 414 | l->d_func()->reparentChildItems(this); | - |
| 415 | l->invalidate(); | - |
| 416 | layoutChanged(); | - |
| 417 | } executed: }Execution Count:187 | 187 |
| 418 | void QGraphicsWidget::adjustSize() | - |
| 419 | { | - |
| 420 | QSizeF sz = effectiveSizeHint(Qt::PreferredSize); | - |
| 421 | | - |
| 422 | if (sz.isValid()) partially evaluated: sz.isValid()| yes Evaluation Count:115 | no Evaluation Count:0 |
| 0-115 |
| 423 | resize(sz); executed: resize(sz);Execution Count:115 | 115 |
| 424 | } executed: }Execution Count:115 | 115 |
| 425 | Qt::LayoutDirection QGraphicsWidget::layoutDirection() const | - |
| 426 | { | - |
| 427 | return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight; executed: return testAttribute(Qt::WA_RightToLeft) ? Qt::RightToLeft : Qt::LeftToRight;Execution Count:1290 | 1290 |
| 428 | } | - |
| 429 | void QGraphicsWidget::setLayoutDirection(Qt::LayoutDirection direction) | - |
| 430 | { | - |
| 431 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 432 | setAttribute(Qt::WA_SetLayoutDirection, true); | - |
| 433 | d->setLayoutDirection_helper(direction); | - |
| 434 | } executed: }Execution Count:12 | 12 |
| 435 | void QGraphicsWidget::unsetLayoutDirection() | - |
| 436 | { | - |
| 437 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 438 | setAttribute(Qt::WA_SetLayoutDirection, false); | - |
| 439 | d->resolveLayoutDirection(); | - |
| 440 | } | 0 |
| 441 | QStyle *QGraphicsWidget::style() const | - |
| 442 | { | - |
| 443 | if (QStyle *style = widgetStyles()->styleForWidget(this)) partially evaluated: QStyle *style = widgetStyles()->styleForWidget(this)| no Evaluation Count:0 | yes Evaluation Count:3349 |
| 0-3349 |
| 444 | return style; never executed: return style; | 0 |
| 445 | | - |
| 446 | return scene() ? scene()->style() : QApplication::style(); executed: return scene() ? scene()->style() : QApplication::style();Execution Count:3349 | 3349 |
| 447 | } | - |
| 448 | void QGraphicsWidget::setStyle(QStyle *style) | - |
| 449 | { | - |
| 450 | setAttribute(Qt::WA_SetStyle, style != 0); | - |
| 451 | widgetStyles()->setStyleForWidget(this, style); | - |
| 452 | | - |
| 453 | | - |
| 454 | QEvent event(QEvent::StyleChange); | - |
| 455 | QApplication::sendEvent(this, &event); | - |
| 456 | } | 0 |
| 457 | QFont QGraphicsWidget::font() const | - |
| 458 | { | - |
| 459 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 460 | QFont fnt = d->font; | - |
| 461 | fnt.resolve(fnt.resolve() | d->inheritedFontResolveMask); | - |
| 462 | return fnt; executed: return fnt;Execution Count:1462 | 1462 |
| 463 | } | - |
| 464 | void QGraphicsWidget::setFont(const QFont &font) | - |
| 465 | { | - |
| 466 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 467 | setAttribute(Qt::WA_SetFont, font.resolve() != 0); | - |
| 468 | | - |
| 469 | QFont naturalFont = d->naturalWidgetFont(); | - |
| 470 | QFont resolvedFont = font.resolve(naturalFont); | - |
| 471 | d->setFont_helper(resolvedFont); | - |
| 472 | } | 0 |
| 473 | QPalette QGraphicsWidget::palette() const | - |
| 474 | { | - |
| 475 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 476 | return d->palette; executed: return d->palette;Execution Count:1512 | 1512 |
| 477 | } | - |
| 478 | void QGraphicsWidget::setPalette(const QPalette &palette) | - |
| 479 | { | - |
| 480 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 481 | setAttribute(Qt::WA_SetPalette, palette.resolve() != 0); | - |
| 482 | | - |
| 483 | QPalette naturalPalette = d->naturalWidgetPalette(); | - |
| 484 | QPalette resolvedPalette = palette.resolve(naturalPalette); | - |
| 485 | d->setPalette_helper(resolvedPalette); | - |
| 486 | } | 0 |
| 487 | bool QGraphicsWidget::autoFillBackground() const | - |
| 488 | { | - |
| 489 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 490 | return d->autoFillBackground; executed: return d->autoFillBackground;Execution Count:216 | 216 |
| 491 | } | - |
| 492 | void QGraphicsWidget::setAutoFillBackground(bool enabled) | - |
| 493 | { | - |
| 494 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 495 | if (d->autoFillBackground != enabled) { never evaluated: d->autoFillBackground != enabled | 0 |
| 496 | d->autoFillBackground = enabled; | - |
| 497 | update(); | - |
| 498 | } | 0 |
| 499 | } | 0 |
| 500 | void QGraphicsWidget::updateGeometry() | - |
| 501 | { | - |
| 502 | QGraphicsLayoutItem::updateGeometry(); | - |
| 503 | QGraphicsLayoutItem *parentItem = parentLayoutItem(); | - |
| 504 | | - |
| 505 | if (parentItem && parentItem->isLayout()) { evaluated: parentItem| yes Evaluation Count:178 | yes Evaluation Count:3039 |
partially evaluated: parentItem->isLayout()| yes Evaluation Count:178 | no Evaluation Count:0 |
| 0-3039 |
| 506 | if (QGraphicsLayout::instantInvalidatePropagation()) { evaluated: QGraphicsLayout::instantInvalidatePropagation()| yes Evaluation Count:25 | yes Evaluation Count:153 |
| 25-153 |
| 507 | static_cast<QGraphicsLayout *>(parentItem)->invalidate(); | - |
| 508 | } else { executed: }Execution Count:25 | 25 |
| 509 | parentItem->updateGeometry(); | - |
| 510 | } executed: }Execution Count:153 | 153 |
| 511 | } else { | - |
| 512 | if (parentItem) { partially evaluated: parentItem| no Evaluation Count:0 | yes Evaluation Count:3039 |
| 0-3039 |
| 513 | | - |
| 514 | QGraphicsWidget *parentWid = parentWidget(); | - |
| 515 | if (parentWid->isVisible()) never evaluated: parentWid->isVisible() | 0 |
| 516 | QApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest)); never executed: QApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest)); | 0 |
| 517 | } else { | 0 |
| 518 | | - |
| 519 | | - |
| 520 | | - |
| 521 | | - |
| 522 | | - |
| 523 | if (QGraphicsLayout::instantInvalidatePropagation()) evaluated: QGraphicsLayout::instantInvalidatePropagation()| yes Evaluation Count:22 | yes Evaluation Count:3017 |
| 22-3017 |
| 524 | QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest)); executed: QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));Execution Count:22 | 22 |
| 525 | } executed: }Execution Count:3039 | 3039 |
| 526 | if (!QGraphicsLayout::instantInvalidatePropagation()) { evaluated: !QGraphicsLayout::instantInvalidatePropagation()| yes Evaluation Count:3017 | yes Evaluation Count:22 |
| 22-3017 |
| 527 | bool wasResized = testAttribute(Qt::WA_Resized); | - |
| 528 | resize(size()); | - |
| 529 | setAttribute(Qt::WA_Resized, wasResized); | - |
| 530 | } executed: }Execution Count:3017 | 3017 |
| 531 | } executed: }Execution Count:3039 | 3039 |
| 532 | } | - |
| 533 | QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value) | - |
| 534 | { | - |
| 535 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 536 | switch (change) { | - |
| 537 | case ItemEnabledHasChanged: { | - |
| 538 | | - |
| 539 | QEvent event(QEvent::EnabledChange); | - |
| 540 | QApplication::sendEvent(this, &event); | - |
| 541 | break; | 0 |
| 542 | } | - |
| 543 | case ItemVisibleChange: | - |
| 544 | if (value.toBool()) { evaluated: value.toBool()| yes Evaluation Count:748 | yes Evaluation Count:7 |
| 7-748 |
| 545 | | - |
| 546 | QShowEvent event; | - |
| 547 | QApplication::sendEvent(this, &event); | - |
| 548 | bool resized = testAttribute(Qt::WA_Resized); | - |
| 549 | if (!resized) { evaluated: !resized| yes Evaluation Count:114 | yes Evaluation Count:634 |
| 114-634 |
| 550 | adjustSize(); | - |
| 551 | setAttribute(Qt::WA_Resized, false); | - |
| 552 | } executed: }Execution Count:114 | 114 |
| 553 | } executed: }Execution Count:748 | 748 |
| 554 | break; executed: break;Execution Count:755 | 755 |
| 555 | case ItemVisibleHasChanged: | - |
| 556 | if (!value.toBool()) { evaluated: !value.toBool()| yes Evaluation Count:7 | yes Evaluation Count:748 |
| 7-748 |
| 557 | | - |
| 558 | QHideEvent event; | - |
| 559 | QApplication::sendEvent(this, &event); | - |
| 560 | } executed: }Execution Count:7 | 7 |
| 561 | break; executed: break;Execution Count:755 | 755 |
| 562 | case ItemPositionHasChanged: | - |
| 563 | d->setGeometryFromSetPos(); | - |
| 564 | break; executed: break;Execution Count:753 | 753 |
| 565 | case ItemParentChange: { | - |
| 566 | | - |
| 567 | QEvent event(QEvent::ParentAboutToChange); | - |
| 568 | QApplication::sendEvent(this, &event); | - |
| 569 | break; executed: break;Execution Count:467 | 467 |
| 570 | } | - |
| 571 | case ItemParentHasChanged: { | - |
| 572 | | - |
| 573 | QEvent event(QEvent::ParentChange); | - |
| 574 | QApplication::sendEvent(this, &event); | - |
| 575 | break; executed: break;Execution Count:467 | 467 |
| 576 | } | - |
| 577 | case ItemCursorHasChanged: { | - |
| 578 | | - |
| 579 | QEvent event(QEvent::CursorChange); | - |
| 580 | QApplication::sendEvent(this, &event); | - |
| 581 | break; executed: break;Execution Count:1 | 1 |
| 582 | } | - |
| 583 | case ItemToolTipHasChanged: { | - |
| 584 | | - |
| 585 | QEvent event(QEvent::ToolTipChange); | - |
| 586 | QApplication::sendEvent(this, &event); | - |
| 587 | break; | 0 |
| 588 | } | - |
| 589 | default: | - |
| 590 | break; executed: break;Execution Count:3155 | 3155 |
| 591 | } | - |
| 592 | return QGraphicsItem::itemChange(change, value); executed: return QGraphicsItem::itemChange(change, value);Execution Count:6353 | 6353 |
| 593 | } | - |
| 594 | QVariant QGraphicsWidget::propertyChange(const QString &propertyName, const QVariant &value) | - |
| 595 | { | - |
| 596 | (void)propertyName;; | - |
| 597 | return value; never executed: return value; | 0 |
| 598 | } | - |
| 599 | bool QGraphicsWidget::sceneEvent(QEvent *event) | - |
| 600 | { | - |
| 601 | return QGraphicsItem::sceneEvent(event); executed: return QGraphicsItem::sceneEvent(event);Execution Count:124 | 124 |
| 602 | } | - |
| 603 | bool QGraphicsWidget::windowFrameEvent(QEvent *event) | - |
| 604 | { | - |
| 605 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 606 | switch (event->type()) { | - |
| 607 | case QEvent::GraphicsSceneMousePress: | - |
| 608 | d->windowFrameMousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 609 | break; | 0 |
| 610 | case QEvent::GraphicsSceneMouseMove: | - |
| 611 | d->ensureWindowData(); | - |
| 612 | if (d->windowData->grabbedSection != Qt::NoSection) { never evaluated: d->windowData->grabbedSection != Qt::NoSection | 0 |
| 613 | d->windowFrameMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 614 | event->accept(); | - |
| 615 | } | 0 |
| 616 | break; | 0 |
| 617 | case QEvent::GraphicsSceneMouseRelease: | - |
| 618 | d->windowFrameMouseReleaseEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); | - |
| 619 | break; | 0 |
| 620 | case QEvent::GraphicsSceneHoverMove: | - |
| 621 | d->windowFrameHoverMoveEvent(static_cast<QGraphicsSceneHoverEvent *>(event)); | - |
| 622 | break; | 0 |
| 623 | case QEvent::GraphicsSceneHoverLeave: | - |
| 624 | d->windowFrameHoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent *>(event)); | - |
| 625 | break; | 0 |
| 626 | default: | - |
| 627 | break; | 0 |
| 628 | } | - |
| 629 | return event->isAccepted(); never executed: return event->isAccepted(); | 0 |
| 630 | } | - |
| 631 | Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) const | - |
| 632 | { | - |
| 633 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 634 | | - |
| 635 | const QRectF r = windowFrameRect(); | - |
| 636 | if (!r.contains(pos)) never evaluated: !r.contains(pos) | 0 |
| 637 | return Qt::NoSection; never executed: return Qt::NoSection; | 0 |
| 638 | | - |
| 639 | const qreal left = r.left(); | - |
| 640 | const qreal top = r.top(); | - |
| 641 | const qreal right = r.right(); | - |
| 642 | const qreal bottom = r.bottom(); | - |
| 643 | const qreal x = pos.x(); | - |
| 644 | const qreal y = pos.y(); | - |
| 645 | | - |
| 646 | const qreal cornerMargin = 20; | - |
| 647 | | - |
| 648 | const qreal windowFrameWidth = d->windowFrameMargins never evaluated: d->windowFrameMargins | 0 |
| 649 | ? d->windowFrameMargins[d->Left] : 0; | - |
| 650 | | - |
| 651 | Qt::WindowFrameSection s = Qt::NoSection; | - |
| 652 | if (x <= left + cornerMargin) { never evaluated: x <= left + cornerMargin | 0 |
| 653 | if (y <= top + windowFrameWidth || (x <= left + windowFrameWidth && y <= top + cornerMargin)) { never evaluated: y <= top + windowFrameWidth never evaluated: x <= left + windowFrameWidth never evaluated: y <= top + cornerMargin | 0 |
| 654 | s = Qt::TopLeftSection; | - |
| 655 | } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - windowFrameWidth)) { never evaluated: y >= bottom - windowFrameWidth never evaluated: x <= left + windowFrameWidth never evaluated: y >= bottom - windowFrameWidth | 0 |
| 656 | s = Qt::BottomLeftSection; | - |
| 657 | } else if (x <= left + windowFrameWidth) { never evaluated: x <= left + windowFrameWidth | 0 |
| 658 | s = Qt::LeftSection; | - |
| 659 | } | 0 |
| 660 | } else if (x >= right - cornerMargin) { never evaluated: x >= right - cornerMargin | 0 |
| 661 | if (y <= top + windowFrameWidth || (x >= right - windowFrameWidth && y <= top + cornerMargin)) { never evaluated: y <= top + windowFrameWidth never evaluated: x >= right - windowFrameWidth never evaluated: y <= top + cornerMargin | 0 |
| 662 | s = Qt::TopRightSection; | - |
| 663 | } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - windowFrameWidth)) { never evaluated: y >= bottom - windowFrameWidth never evaluated: x >= right - windowFrameWidth never evaluated: y >= bottom - windowFrameWidth | 0 |
| 664 | s = Qt::BottomRightSection; | - |
| 665 | } else if (x >= right - windowFrameWidth) { never evaluated: x >= right - windowFrameWidth | 0 |
| 666 | s = Qt::RightSection; | - |
| 667 | } | 0 |
| 668 | } else if (y <= top + windowFrameWidth) { never evaluated: y <= top + windowFrameWidth | 0 |
| 669 | s = Qt::TopSection; | - |
| 670 | } else if (y >= bottom - windowFrameWidth) { never evaluated: y >= bottom - windowFrameWidth | 0 |
| 671 | s = Qt::BottomSection; | - |
| 672 | } | 0 |
| 673 | if (s == Qt::NoSection) { never evaluated: s == Qt::NoSection | 0 |
| 674 | QRectF r1 = r; | - |
| 675 | r1.setHeight(d->windowFrameMargins | - |
| 676 | ? d->windowFrameMargins[d->Top] : 0); | - |
| 677 | if (r1.contains(pos)) never evaluated: r1.contains(pos) | 0 |
| 678 | s = Qt::TitleBarArea; never executed: s = Qt::TitleBarArea; | 0 |
| 679 | } | 0 |
| 680 | return s; never executed: return s; | 0 |
| 681 | } | - |
| 682 | bool QGraphicsWidget::event(QEvent *event) | - |
| 683 | { | - |
| 684 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 685 | | - |
| 686 | if (d->layout) evaluated: d->layout| yes Evaluation Count:780 | yes Evaluation Count:5921 |
| 780-5921 |
| 687 | d->layout->widgetEvent(event); executed: d->layout->widgetEvent(event);Execution Count:780 | 780 |
| 688 | | - |
| 689 | | - |
| 690 | switch (event->type()) { | - |
| 691 | case QEvent::GraphicsSceneMove: | - |
| 692 | moveEvent(static_cast<QGraphicsSceneMoveEvent *>(event)); | - |
| 693 | break; executed: break;Execution Count:753 | 753 |
| 694 | case QEvent::GraphicsSceneResize: | - |
| 695 | resizeEvent(static_cast<QGraphicsSceneResizeEvent *>(event)); | - |
| 696 | break; executed: break;Execution Count:1738 | 1738 |
| 697 | case QEvent::Show: | - |
| 698 | showEvent(static_cast<QShowEvent *>(event)); | - |
| 699 | break; executed: break;Execution Count:748 | 748 |
| 700 | case QEvent::Hide: | - |
| 701 | hideEvent(static_cast<QHideEvent *>(event)); | - |
| 702 | break; executed: break;Execution Count:7 | 7 |
| 703 | case QEvent::Polish: | - |
| 704 | polishEvent(); | - |
| 705 | d->polished = true; | - |
| 706 | if (!d->font.isCopyOf(QApplication::font())) partially evaluated: !d->font.isCopyOf(QApplication::font())| no Evaluation Count:0 | yes Evaluation Count:746 |
| 0-746 |
| 707 | d->updateFont(d->font); never executed: d->updateFont(d->font); | 0 |
| 708 | break; executed: break;Execution Count:746 | 746 |
| 709 | case QEvent::WindowActivate: | - |
| 710 | case QEvent::WindowDeactivate: | - |
| 711 | case QEvent::StyleAnimationUpdate: | - |
| 712 | update(); | - |
| 713 | break; executed: break;Execution Count:114 | 114 |
| 714 | | - |
| 715 | case QEvent::ActivationChange: | - |
| 716 | case QEvent::EnabledChange: | - |
| 717 | case QEvent::FontChange: | - |
| 718 | case QEvent::StyleChange: | - |
| 719 | case QEvent::PaletteChange: | - |
| 720 | case QEvent::ParentChange: | - |
| 721 | case QEvent::ContentsRectChange: | - |
| 722 | case QEvent::LayoutDirectionChange: | - |
| 723 | changeEvent(event); | - |
| 724 | break; executed: break;Execution Count:1915 | 1915 |
| 725 | case QEvent::Close: | - |
| 726 | closeEvent((QCloseEvent *)event); | - |
| 727 | break; | 0 |
| 728 | case QEvent::GrabMouse: | - |
| 729 | grabMouseEvent(event); | - |
| 730 | break; executed: break;Execution Count:2 | 2 |
| 731 | case QEvent::UngrabMouse: | - |
| 732 | ungrabMouseEvent(event); | - |
| 733 | break; executed: break;Execution Count:2 | 2 |
| 734 | case QEvent::GrabKeyboard: | - |
| 735 | grabKeyboardEvent(event); | - |
| 736 | break; | 0 |
| 737 | case QEvent::UngrabKeyboard: | - |
| 738 | ungrabKeyboardEvent(event); | - |
| 739 | break; | 0 |
| 740 | case QEvent::GraphicsSceneMousePress: | - |
| 741 | if (d->hasDecoration() && windowFrameEvent(event)) never evaluated: d->hasDecoration() never evaluated: windowFrameEvent(event) | 0 |
| 742 | return true; never executed: return true; | 0 |
| 743 | case QEvent::GraphicsSceneMouseMove: code before this statement never executed: case QEvent::GraphicsSceneMouseMove: | 0 |
| 744 | case QEvent::GraphicsSceneMouseRelease: | - |
| 745 | case QEvent::GraphicsSceneMouseDoubleClick: | - |
| 746 | d->ensureWindowData(); | - |
| 747 | if (d->hasDecoration() && d->windowData->grabbedSection != Qt::NoSection) partially evaluated: d->hasDecoration()| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: d->windowData->grabbedSection != Qt::NoSection | 0-2 |
| 748 | return windowFrameEvent(event); never executed: return windowFrameEvent(event); | 0 |
| 749 | break; executed: break;Execution Count:2 | 2 |
| 750 | case QEvent::GraphicsSceneHoverEnter: | - |
| 751 | case QEvent::GraphicsSceneHoverMove: | - |
| 752 | case QEvent::GraphicsSceneHoverLeave: | - |
| 753 | if (d->hasDecoration()) { never evaluated: d->hasDecoration() | 0 |
| 754 | windowFrameEvent(event); | - |
| 755 | | - |
| 756 | | - |
| 757 | if (!acceptHoverEvents()) never evaluated: !acceptHoverEvents() | 0 |
| 758 | return true; never executed: return true; | 0 |
| 759 | } | 0 |
| 760 | break; | 0 |
| 761 | default: | - |
| 762 | break; executed: break;Execution Count:674 | 674 |
| 763 | } | - |
| 764 | return QObject::event(event); executed: return QObject::event(event);Execution Count:6701 | 6701 |
| 765 | } | - |
| 766 | void QGraphicsWidget::changeEvent(QEvent *event) | - |
| 767 | { | - |
| 768 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 769 | switch (event->type()) { | - |
| 770 | case QEvent::StyleChange: | - |
| 771 | | - |
| 772 | unsetWindowFrameMargins(); | - |
| 773 | if (d->layout) never evaluated: d->layout | 0 |
| 774 | d->layout->invalidate(); never executed: d->layout->invalidate(); | 0 |
| 775 | case QEvent::FontChange: code before this statement never executed: case QEvent::FontChange: | 0 |
| 776 | update(); | - |
| 777 | updateGeometry(); | - |
| 778 | break; | 0 |
| 779 | case QEvent::PaletteChange: | - |
| 780 | update(); | - |
| 781 | break; executed: break;Execution Count:1434 | 1434 |
| 782 | case QEvent::ParentChange: | - |
| 783 | d->resolveFont(d->inheritedFontResolveMask); | - |
| 784 | d->resolvePalette(d->inheritedPaletteResolveMask); | - |
| 785 | break; executed: break;Execution Count:467 | 467 |
| 786 | default: | - |
| 787 | break; executed: break;Execution Count:14 | 14 |
| 788 | } | - |
| 789 | } executed: }Execution Count:1915 | 1915 |
| 790 | void QGraphicsWidget::closeEvent(QCloseEvent *event) | - |
| 791 | { | - |
| 792 | event->accept(); | - |
| 793 | } | 0 |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | | - |
| 798 | void QGraphicsWidget::focusInEvent(QFocusEvent *event) | - |
| 799 | { | - |
| 800 | (void)event;; | - |
| 801 | if (focusPolicy() != Qt::NoFocus) partially evaluated: focusPolicy() != Qt::NoFocus| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 802 | update(); executed: update();Execution Count:1 | 1 |
| 803 | } executed: }Execution Count:1 | 1 |
| 804 | bool QGraphicsWidget::focusNextPrevChild(bool next) | - |
| 805 | { | - |
| 806 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 807 | | - |
| 808 | QGraphicsWidget *parent = 0; | - |
| 809 | if (!isWindow() && (parent = parentWidget())) never evaluated: !isWindow() never evaluated: (parent = parentWidget()) | 0 |
| 810 | return parent->focusNextPrevChild(next); never executed: return parent->focusNextPrevChild(next); | 0 |
| 811 | if (!d->scene) never evaluated: !d->scene | 0 |
| 812 | return false; never executed: return false; | 0 |
| 813 | if (d->scene->focusNextPrevChild(next)) never evaluated: d->scene->focusNextPrevChild(next) | 0 |
| 814 | return true; never executed: return true; | 0 |
| 815 | if (isWindow()) { never evaluated: isWindow() | 0 |
| 816 | setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason); | - |
| 817 | if (hasFocus()) never evaluated: hasFocus() | 0 |
| 818 | return true; never executed: return true; | 0 |
| 819 | } | 0 |
| 820 | return false; never executed: return false; | 0 |
| 821 | } | - |
| 822 | | - |
| 823 | | - |
| 824 | | - |
| 825 | | - |
| 826 | void QGraphicsWidget::focusOutEvent(QFocusEvent *event) | - |
| 827 | { | - |
| 828 | (void)event;; | - |
| 829 | if (focusPolicy() != Qt::NoFocus) partially evaluated: focusPolicy() != Qt::NoFocus| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 830 | update(); executed: update();Execution Count:1 | 1 |
| 831 | } executed: }Execution Count:1 | 1 |
| 832 | void QGraphicsWidget::hideEvent(QHideEvent *event) | - |
| 833 | { | - |
| 834 | | - |
| 835 | | - |
| 836 | (void)event;; | - |
| 837 | } executed: }Execution Count:3 | 3 |
| 838 | void QGraphicsWidget::moveEvent(QGraphicsSceneMoveEvent *event) | - |
| 839 | { | - |
| 840 | | - |
| 841 | (void)event;; | - |
| 842 | } executed: }Execution Count:753 | 753 |
| 843 | void QGraphicsWidget::polishEvent() | - |
| 844 | { | - |
| 845 | } | - |
| 846 | void QGraphicsWidget::resizeEvent(QGraphicsSceneResizeEvent *event) | - |
| 847 | { | - |
| 848 | (void)event;; | - |
| 849 | } executed: }Execution Count:1738 | 1738 |
| 850 | void QGraphicsWidget::showEvent(QShowEvent *event) | - |
| 851 | { | - |
| 852 | (void)event;; | - |
| 853 | } executed: }Execution Count:743 | 743 |
| 854 | | - |
| 855 | | - |
| 856 | | - |
| 857 | | - |
| 858 | void QGraphicsWidget::hoverMoveEvent(QGraphicsSceneHoverEvent *event) | - |
| 859 | { | - |
| 860 | (void)event;; | - |
| 861 | } | 0 |
| 862 | | - |
| 863 | | - |
| 864 | | - |
| 865 | | - |
| 866 | void QGraphicsWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) | - |
| 867 | { | - |
| 868 | (void)event;; | - |
| 869 | } | 0 |
| 870 | | - |
| 871 | | - |
| 872 | | - |
| 873 | | - |
| 874 | | - |
| 875 | | - |
| 876 | | - |
| 877 | void QGraphicsWidget::grabMouseEvent(QEvent *event) | - |
| 878 | { | - |
| 879 | (void)event;; | - |
| 880 | } executed: }Execution Count:2 | 2 |
| 881 | | - |
| 882 | | - |
| 883 | | - |
| 884 | | - |
| 885 | | - |
| 886 | | - |
| 887 | | - |
| 888 | void QGraphicsWidget::ungrabMouseEvent(QEvent *event) | - |
| 889 | { | - |
| 890 | (void)event;; | - |
| 891 | } executed: }Execution Count:2 | 2 |
| 892 | | - |
| 893 | | - |
| 894 | | - |
| 895 | | - |
| 896 | | - |
| 897 | | - |
| 898 | | - |
| 899 | void QGraphicsWidget::grabKeyboardEvent(QEvent *event) | - |
| 900 | { | - |
| 901 | (void)event;; | - |
| 902 | } | 0 |
| 903 | | - |
| 904 | | - |
| 905 | | - |
| 906 | | - |
| 907 | | - |
| 908 | | - |
| 909 | | - |
| 910 | void QGraphicsWidget::ungrabKeyboardEvent(QEvent *event) | - |
| 911 | { | - |
| 912 | (void)event;; | - |
| 913 | } | 0 |
| 914 | | - |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | | - |
| 920 | Qt::WindowType QGraphicsWidget::windowType() const | - |
| 921 | { | - |
| 922 | return Qt::WindowType(int(windowFlags()) & Qt::WindowType_Mask); executed: return Qt::WindowType(int(windowFlags()) & Qt::WindowType_Mask);Execution Count:4453 | 4453 |
| 923 | } | - |
| 924 | Qt::WindowFlags QGraphicsWidget::windowFlags() const | - |
| 925 | { | - |
| 926 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 927 | return d->windowFlags; executed: return d->windowFlags;Execution Count:4482 | 4482 |
| 928 | } | - |
| 929 | void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags) | - |
| 930 | { | - |
| 931 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 932 | if (d->windowFlags == wFlags) partially evaluated: d->windowFlags == wFlags| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 933 | return; | 0 |
| 934 | bool wasPopup = (d->windowFlags & Qt::WindowType_Mask) == Qt::Popup; | - |
| 935 | | - |
| 936 | d->adjustWindowFlags(&wFlags); | - |
| 937 | d->windowFlags = wFlags; | - |
| 938 | if (!d->setWindowFrameMargins) partially evaluated: !d->setWindowFrameMargins| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 939 | unsetWindowFrameMargins(); executed: unsetWindowFrameMargins();Execution Count:1 | 1 |
| 940 | | - |
| 941 | setFlag(ItemIsPanel, d->windowFlags & Qt::Window); | - |
| 942 | | - |
| 943 | bool isPopup = (d->windowFlags & Qt::WindowType_Mask) == Qt::Popup; | - |
| 944 | if (d->scene && isVisible() && wasPopup != isPopup) { partially evaluated: d->scene| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: isVisible()| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: wasPopup != isPopup| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 945 | | - |
| 946 | if (!isPopup) never evaluated: !isPopup | 0 |
| 947 | d->scene->d_func()->removePopup(this); never executed: d->scene->d_func()->removePopup(this); | 0 |
| 948 | else | - |
| 949 | d->scene->d_func()->addPopup(this); never executed: d->scene->d_func()->addPopup(this); | 0 |
| 950 | } | - |
| 951 | | - |
| 952 | if (d->scene && d->scene->d_func()->allItemsIgnoreHoverEvents && d->hasDecoration()) { partially evaluated: d->scene| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->scene->d_func()->allItemsIgnoreHoverEvents| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->hasDecoration()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 953 | d->scene->d_func()->allItemsIgnoreHoverEvents = false; | - |
| 954 | d->scene->d_func()->enableMouseTrackingOnViews(); | - |
| 955 | } executed: }Execution Count:1 | 1 |
| 956 | } executed: }Execution Count:1 | 1 |
| 957 | bool QGraphicsWidget::isActiveWindow() const | - |
| 958 | { | - |
| 959 | return isActive(); executed: return isActive();Execution Count:651 | 651 |
| 960 | } | - |
| 961 | void QGraphicsWidget::setWindowTitle(const QString &title) | - |
| 962 | { | - |
| 963 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 964 | d->ensureWindowData(); | - |
| 965 | d->windowData->windowTitle = title; | - |
| 966 | } executed: }Execution Count:8 | 8 |
| 967 | QString QGraphicsWidget::windowTitle() const | - |
| 968 | { | - |
| 969 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 970 | return d->windowData ? d->windowData->windowTitle : QString(); never executed: return d->windowData ? d->windowData->windowTitle : QString(); | 0 |
| 971 | } | - |
| 972 | Qt::FocusPolicy QGraphicsWidget::focusPolicy() const | - |
| 973 | { | - |
| 974 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 975 | return d->focusPolicy; executed: return d->focusPolicy;Execution Count:4 | 4 |
| 976 | } | - |
| 977 | void QGraphicsWidget::setFocusPolicy(Qt::FocusPolicy policy) | - |
| 978 | { | - |
| 979 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 980 | if (d->focusPolicy == policy) partially evaluated: d->focusPolicy == policy| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 981 | return; | 0 |
| 982 | d->focusPolicy = policy; | - |
| 983 | if (hasFocus() && policy == Qt::NoFocus) partially evaluated: hasFocus()| no Evaluation Count:0 | yes Evaluation Count:9 |
never evaluated: policy == Qt::NoFocus | 0-9 |
| 984 | clearFocus(); never executed: clearFocus(); | 0 |
| 985 | setFlag(ItemIsFocusable, policy != Qt::NoFocus); | - |
| 986 | } executed: }Execution Count:9 | 9 |
| 987 | QGraphicsWidget *QGraphicsWidget::focusWidget() const | - |
| 988 | { | - |
| 989 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 990 | if (d->subFocusItem && d->subFocusItem->d_ptr->isWidget) never evaluated: d->subFocusItem never evaluated: d->subFocusItem->d_ptr->isWidget | 0 |
| 991 | return static_cast<QGraphicsWidget *>(d->subFocusItem); never executed: return static_cast<QGraphicsWidget *>(d->subFocusItem); | 0 |
| 992 | return 0; never executed: return 0; | 0 |
| 993 | } | - |
| 994 | int QGraphicsWidget::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context) | - |
| 995 | { | - |
| 996 | qt_noop(); | - |
| 997 | if (sequence.isEmpty()) never evaluated: sequence.isEmpty() | 0 |
| 998 | return 0; never executed: return 0; | 0 |
| 999 | | - |
| 1000 | return (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.addShortcut(this, sequence, context, qWidgetShortcutContextMatcher); never executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.addShortcut(this, sequence, context, qWidgetShortcutContextMatcher); | 0 |
| 1001 | } | - |
| 1002 | void QGraphicsWidget::releaseShortcut(int id) | - |
| 1003 | { | - |
| 1004 | qt_noop(); | - |
| 1005 | if (id) | 0 |
| 1006 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0); never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.removeShortcut(id, this, 0); | 0 |
| 1007 | } | 0 |
| 1008 | void QGraphicsWidget::setShortcutEnabled(int id, bool enabled) | - |
| 1009 | { | - |
| 1010 | qt_noop(); | - |
| 1011 | if (id) | 0 |
| 1012 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enabled, id, this, 0); never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutEnabled(enabled, id, this, 0); | 0 |
| 1013 | } | 0 |
| 1014 | void QGraphicsWidget::setShortcutAutoRepeat(int id, bool enabled) | - |
| 1015 | { | - |
| 1016 | qt_noop(); | - |
| 1017 | if (id) | 0 |
| 1018 | (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(enabled, id, this, 0); never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.setShortcutAutoRepeat(enabled, id, this, 0); | 0 |
| 1019 | } | 0 |
| 1020 | void QGraphicsWidget::addAction(QAction *action) | - |
| 1021 | { | - |
| 1022 | insertAction(0, action); | - |
| 1023 | } | 0 |
| 1024 | void QGraphicsWidget::addActions(QList<QAction *> actions) | - |
| 1025 | { | - |
| 1026 | for (int i = 0; i < actions.count(); ++i) never evaluated: i < actions.count() | 0 |
| 1027 | insertAction(0, actions.at(i)); never executed: insertAction(0, actions.at(i)); | 0 |
| 1028 | } | 0 |
| 1029 | void QGraphicsWidget::insertAction(QAction *before, QAction *action) | - |
| 1030 | { | - |
| 1031 | if (!action) { | 0 |
| 1032 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 2017, __PRETTY_FUNCTION__).warning("QWidget::insertAction: Attempt to insert null action"); | - |
| 1033 | return; | 0 |
| 1034 | } | - |
| 1035 | | - |
| 1036 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1037 | int index = d->actions.indexOf(action); | - |
| 1038 | if (index != -1) never evaluated: index != -1 | 0 |
| 1039 | d->actions.removeAt(index); never executed: d->actions.removeAt(index); | 0 |
| 1040 | | - |
| 1041 | int pos = d->actions.indexOf(before); | - |
| 1042 | if (pos < 0) { | 0 |
| 1043 | before = 0; | - |
| 1044 | pos = d->actions.size(); | - |
| 1045 | } | 0 |
| 1046 | d->actions.insert(pos, action); | - |
| 1047 | | - |
| 1048 | if (index == -1) { never evaluated: index == -1 | 0 |
| 1049 | QActionPrivate *apriv = action->d_func(); | - |
| 1050 | apriv->graphicsWidgets.append(this); | - |
| 1051 | } | 0 |
| 1052 | | - |
| 1053 | QActionEvent e(QEvent::ActionAdded, action, before); | - |
| 1054 | QApplication::sendEvent(this, &e); | - |
| 1055 | } | 0 |
| 1056 | void QGraphicsWidget::insertActions(QAction *before, QList<QAction *> actions) | - |
| 1057 | { | - |
| 1058 | for (int i = 0; i < actions.count(); ++i) never evaluated: i < actions.count() | 0 |
| 1059 | insertAction(before, actions.at(i)); never executed: insertAction(before, actions.at(i)); | 0 |
| 1060 | } | 0 |
| 1061 | void QGraphicsWidget::removeAction(QAction *action) | - |
| 1062 | { | - |
| 1063 | if (!action) | 0 |
| 1064 | return; | 0 |
| 1065 | | - |
| 1066 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1067 | | - |
| 1068 | QActionPrivate *apriv = action->d_func(); | - |
| 1069 | apriv->graphicsWidgets.removeAll(this); | - |
| 1070 | | - |
| 1071 | if (d->actions.removeAll(action)) { never evaluated: d->actions.removeAll(action) | 0 |
| 1072 | QActionEvent e(QEvent::ActionRemoved, action); | - |
| 1073 | QApplication::sendEvent(this, &e); | - |
| 1074 | } | 0 |
| 1075 | } | 0 |
| 1076 | QList<QAction *> QGraphicsWidget::actions() const | - |
| 1077 | { | - |
| 1078 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1079 | return d->actions; never executed: return d->actions; | 0 |
| 1080 | } | - |
| 1081 | void QGraphicsWidget::setTabOrder(QGraphicsWidget *first, QGraphicsWidget *second) | - |
| 1082 | { | - |
| 1083 | if (!first && !second) { | 0 |
| 1084 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 2124, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder(0, 0) is undefined"); | - |
| 1085 | return; | 0 |
| 1086 | } | - |
| 1087 | if ((first && second) && first->scene() != second->scene()) { never evaluated: first->scene() != second->scene() | 0 |
| 1088 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 2128, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder: scenes %p and %p are different", | - |
| 1089 | first->scene(), second->scene()); | - |
| 1090 | return; | 0 |
| 1091 | } | - |
| 1092 | QGraphicsScene *scene = first ? first->scene() : second->scene(); | 0 |
| 1093 | if (!scene && (!first || !second)) { | 0 |
| 1094 | QMessageLogger("graphicsview/qgraphicswidget.cpp", 2134, __PRETTY_FUNCTION__).warning("QGraphicsWidget::setTabOrder: assigning tab order from/to the" | - |
| 1095 | " scene requires the item to be in a scene."); | - |
| 1096 | return; | 0 |
| 1097 | } | - |
| 1098 | | - |
| 1099 | | - |
| 1100 | | - |
| 1101 | | - |
| 1102 | QGraphicsScenePrivate *sceneD = scene->d_func(); | - |
| 1103 | if (!first) { | 0 |
| 1104 | sceneD->tabFocusFirst = second; | - |
| 1105 | return; | 0 |
| 1106 | } | - |
| 1107 | if (!second) { | 0 |
| 1108 | sceneD->tabFocusFirst = first->d_func()->focusNext; | - |
| 1109 | return; | 0 |
| 1110 | } | - |
| 1111 | | - |
| 1112 | | - |
| 1113 | QGraphicsWidget *firstFocusNext = first->d_func()->focusNext; | - |
| 1114 | if (firstFocusNext == second) { never evaluated: firstFocusNext == second | 0 |
| 1115 | | - |
| 1116 | return; | 0 |
| 1117 | } | - |
| 1118 | | - |
| 1119 | | - |
| 1120 | QGraphicsWidget *secondFocusPrev = second->d_func()->focusPrev; | - |
| 1121 | QGraphicsWidget *secondFocusNext = second->d_func()->focusNext; | - |
| 1122 | firstFocusNext->d_func()->focusPrev = second; | - |
| 1123 | first->d_func()->focusNext = second; | - |
| 1124 | second->d_func()->focusNext = firstFocusNext; | - |
| 1125 | second->d_func()->focusPrev = first; | - |
| 1126 | secondFocusPrev->d_func()->focusNext = secondFocusNext; | - |
| 1127 | secondFocusNext->d_func()->focusPrev = secondFocusPrev; | - |
| 1128 | | - |
| 1129 | qt_noop(); | - |
| 1130 | qt_noop(); | - |
| 1131 | | - |
| 1132 | qt_noop(); | - |
| 1133 | qt_noop(); | - |
| 1134 | | - |
| 1135 | } | 0 |
| 1136 | void QGraphicsWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) | - |
| 1137 | { | - |
| 1138 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1139 | | - |
| 1140 | | - |
| 1141 | | - |
| 1142 | d->setAttribute(attribute, on); | - |
| 1143 | } executed: }Execution Count:7543 | 7543 |
| 1144 | | - |
| 1145 | | - |
| 1146 | | - |
| 1147 | | - |
| 1148 | | - |
| 1149 | | - |
| 1150 | | - |
| 1151 | bool QGraphicsWidget::testAttribute(Qt::WidgetAttribute attribute) const | - |
| 1152 | { | - |
| 1153 | const QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1154 | return d->testAttribute(attribute); executed: return d->testAttribute(attribute);Execution Count:6923 | 6923 |
| 1155 | } | - |
| 1156 | | - |
| 1157 | | - |
| 1158 | | - |
| 1159 | | - |
| 1160 | int QGraphicsWidget::type() const | - |
| 1161 | { | - |
| 1162 | return Type; never executed: return Type; | 0 |
| 1163 | } | - |
| 1164 | | - |
| 1165 | | - |
| 1166 | | - |
| 1167 | | - |
| 1168 | void QGraphicsWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | - |
| 1169 | { | - |
| 1170 | (void)painter;; | - |
| 1171 | (void)option;; | - |
| 1172 | (void)widget;; | - |
| 1173 | } executed: }Execution Count:84 | 84 |
| 1174 | void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, | - |
| 1175 | QWidget *widget) | - |
| 1176 | { | - |
| 1177 | const bool fillBackground = !testAttribute(Qt::WA_OpaquePaintEvent) partially evaluated: !testAttribute(Qt::WA_OpaquePaintEvent)| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 1178 | && !testAttribute(Qt::WA_NoSystemBackground); partially evaluated: !testAttribute(Qt::WA_NoSystemBackground)| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 1179 | QGraphicsProxyWidget *proxy = qobject_cast<QGraphicsProxyWidget *>(this); | - |
| 1180 | const bool embeddedWidgetFillsOwnBackground = proxy && proxy->widget(); partially evaluated: proxy| no Evaluation Count:0 | yes Evaluation Count:29 |
never evaluated: proxy->widget() | 0-29 |
| 1181 | | - |
| 1182 | if (rect().contains(option->exposedRect)) { evaluated: rect().contains(option->exposedRect)| yes Evaluation Count:1 | yes Evaluation Count:28 |
| 1-28 |
| 1183 | if (fillBackground && !embeddedWidgetFillsOwnBackground) partially evaluated: fillBackground| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !embeddedWidgetFillsOwnBackground| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1184 | painter->fillRect(option->exposedRect, palette().window()); executed: painter->fillRect(option->exposedRect, palette().window());Execution Count:1 | 1 |
| 1185 | return; executed: return;Execution Count:1 | 1 |
| 1186 | } | - |
| 1187 | | - |
| 1188 | QGraphicsWidgetPrivate * const d = d_func(); | - |
| 1189 | | - |
| 1190 | QRect windowFrameRect = QRect(QPoint(), windowFrameGeometry().size().toSize()); | - |
| 1191 | QStyleOptionTitleBar bar; | - |
| 1192 | bar.QStyleOption::operator=(*option); | - |
| 1193 | d->initStyleOptionTitleBar(&bar); | - |
| 1194 | d->ensureWindowData(); | - |
| 1195 | if (d->windowData->buttonMouseOver) partially evaluated: d->windowData->buttonMouseOver| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1196 | bar.state |= QStyle::State_MouseOver; never executed: bar.state |= QStyle::State_MouseOver; | 0 |
| 1197 | else | - |
| 1198 | bar.state &= ~QStyle::State_MouseOver; executed: bar.state &= ~QStyle::State_MouseOver;Execution Count:28 | 28 |
| 1199 | if (d->windowData->buttonSunken) partially evaluated: d->windowData->buttonSunken| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1200 | bar.state |= QStyle::State_Sunken; never executed: bar.state |= QStyle::State_Sunken; | 0 |
| 1201 | else | - |
| 1202 | bar.state &= ~QStyle::State_Sunken; executed: bar.state &= ~QStyle::State_Sunken;Execution Count:28 | 28 |
| 1203 | | - |
| 1204 | bar.rect = windowFrameRect; | - |
| 1205 | | - |
| 1206 | | - |
| 1207 | const QPointF styleOrigin = this->windowFrameRect().topLeft(); | - |
| 1208 | painter->translate(styleOrigin); | - |
| 1209 | QStyleHintReturnMask mask; | - |
| 1210 | bool setMask = style()->styleHint(QStyle::SH_WindowFrame_Mask, &bar, widget, &mask) && !mask.region.isEmpty(); partially evaluated: style()->styleHint(QStyle::SH_WindowFrame_Mask, &bar, widget, &mask)| no Evaluation Count:0 | yes Evaluation Count:28 |
never evaluated: !mask.region.isEmpty() | 0-28 |
| 1211 | bool hasBorder = !style()->styleHint(QStyle::SH_TitleBar_NoBorder, &bar, widget); | - |
| 1212 | int frameWidth = style()->pixelMetric(QStyle::PM_MDIFrameWidth, &bar, widget); | - |
| 1213 | if (setMask) { partially evaluated: setMask| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1214 | painter->save(); | - |
| 1215 | painter->setClipRegion(mask.region, Qt::IntersectClip); | - |
| 1216 | } | 0 |
| 1217 | if (fillBackground) { partially evaluated: fillBackground| yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
| 1218 | if (embeddedWidgetFillsOwnBackground) { partially evaluated: embeddedWidgetFillsOwnBackground| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1219 | | - |
| 1220 | QPainterPath windowFrameBackground; | - |
| 1221 | windowFrameBackground.addRect(windowFrameRect); | - |
| 1222 | | - |
| 1223 | | - |
| 1224 | windowFrameBackground.addRect(rect().translated(-styleOrigin).adjusted(0.5, 0.5, -0.5, -0.5)); | - |
| 1225 | painter->fillPath(windowFrameBackground, palette().window()); | - |
| 1226 | } else { | 0 |
| 1227 | painter->fillRect(windowFrameRect, palette().window()); | - |
| 1228 | } executed: }Execution Count:28 | 28 |
| 1229 | } | - |
| 1230 | | - |
| 1231 | | - |
| 1232 | int height = (int)d->titleBarHeight(bar); | - |
| 1233 | bar.rect.setHeight(height); | - |
| 1234 | if (hasBorder) partially evaluated: hasBorder| yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
| 1235 | bar.rect.adjust(frameWidth, frameWidth, -frameWidth, 0); executed: bar.rect.adjust(frameWidth, frameWidth, -frameWidth, 0);Execution Count:28 | 28 |
| 1236 | | - |
| 1237 | painter->save(); | - |
| 1238 | painter->setFont(QApplication::font("QMdiSubWindowTitleBar")); | - |
| 1239 | style()->drawComplexControl(QStyle::CC_TitleBar, &bar, painter, widget); | - |
| 1240 | painter->restore(); | - |
| 1241 | if (setMask) partially evaluated: setMask| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1242 | painter->restore(); never executed: painter->restore(); | 0 |
| 1243 | | - |
| 1244 | QStyleOptionFrame frameOptions; | - |
| 1245 | frameOptions.QStyleOption::operator=(*option); | - |
| 1246 | initStyleOption(&frameOptions); | - |
| 1247 | if (!hasBorder) partially evaluated: !hasBorder| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1248 | painter->setClipRect(windowFrameRect.adjusted(0, +height, 0, 0), Qt::IntersectClip); never executed: painter->setClipRect(windowFrameRect.adjusted(0, +height, 0, 0), Qt::IntersectClip); | 0 |
| 1249 | if (hasFocus()) { partially evaluated: hasFocus()| no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-28 |
| 1250 | frameOptions.state |= QStyle::State_HasFocus; | - |
| 1251 | } else { | 0 |
| 1252 | frameOptions.state &= ~QStyle::State_HasFocus; | - |
| 1253 | } executed: }Execution Count:28 | 28 |
| 1254 | bool isActive = isActiveWindow(); | - |
| 1255 | if (isActive) { evaluated: isActive| yes Evaluation Count:16 | yes Evaluation Count:12 |
| 12-16 |
| 1256 | frameOptions.state |= QStyle::State_Active; | - |
| 1257 | } else { executed: }Execution Count:16 | 16 |
| 1258 | frameOptions.state &= ~QStyle::State_Active; | - |
| 1259 | } executed: }Execution Count:12 | 12 |
| 1260 | | - |
| 1261 | frameOptions.palette.setCurrentColorGroup(isActive ? QPalette::Active : QPalette::Normal); | - |
| 1262 | frameOptions.rect = windowFrameRect; | - |
| 1263 | frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, widget); | - |
| 1264 | frameOptions.midLineWidth = 1; | - |
| 1265 | style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget); | - |
| 1266 | | - |
| 1267 | | - |
| 1268 | | - |
| 1269 | | - |
| 1270 | | - |
| 1271 | } executed: }Execution Count:28 | 28 |
| 1272 | | - |
| 1273 | | - |
| 1274 | | - |
| 1275 | | - |
| 1276 | QRectF QGraphicsWidget::boundingRect() const | - |
| 1277 | { | - |
| 1278 | return windowFrameRect(); executed: return windowFrameRect();Execution Count:2862 | 2862 |
| 1279 | } | - |
| 1280 | | - |
| 1281 | | - |
| 1282 | | - |
| 1283 | | - |
| 1284 | QPainterPath QGraphicsWidget::shape() const | - |
| 1285 | { | - |
| 1286 | QPainterPath path; | - |
| 1287 | path.addRect(rect()); | - |
| 1288 | return path; executed: return path;Execution Count:75 | 75 |
| 1289 | } | - |
| 1290 | bool QGraphicsWidget::close() | - |
| 1291 | { | - |
| 1292 | QCloseEvent closeEvent; | - |
| 1293 | QApplication::sendEvent(this, &closeEvent); | - |
| 1294 | if (!closeEvent.isAccepted()) { never evaluated: !closeEvent.isAccepted() | 0 |
| 1295 | return false; never executed: return false; | 0 |
| 1296 | } | - |
| 1297 | | - |
| 1298 | if (isVisible()) { never evaluated: isVisible() | 0 |
| 1299 | hide(); | - |
| 1300 | } | 0 |
| 1301 | if (testAttribute(Qt::WA_DeleteOnClose)) { never evaluated: testAttribute(Qt::WA_DeleteOnClose) | 0 |
| 1302 | deleteLater(); | - |
| 1303 | } | 0 |
| 1304 | return true; never executed: return true; | 0 |
| 1305 | } | - |
| 1306 | | - |
| 1307 | | - |
| | |