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