| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicslayout_p.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | void QGraphicsLayoutPrivate::reparentChildItems(QGraphicsItem *newParent) | - | ||||||||||||||||||||||||
| 14 | { | - | ||||||||||||||||||||||||
| 15 | QGraphicsLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 16 | int n = q->count(); | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | for (int i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 19 | QGraphicsLayoutItem *layoutChild = q->itemAt(i); | - | ||||||||||||||||||||||||
| 20 | if (!layoutChild
| 0 | ||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||
| 22 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 23 | } | - | ||||||||||||||||||||||||
| 24 | if (layoutChild->isLayout()
| 0 | ||||||||||||||||||||||||
| 25 | QGraphicsLayout *l = static_cast<QGraphicsLayout*>(layoutChild); | - | ||||||||||||||||||||||||
| 26 | l->d_func()->reparentChildItems(newParent); | - | ||||||||||||||||||||||||
| 27 | } never executed: else if (QGraphicsItem *itemChild = layoutChild->graphicsItem()end of block
| 0 | ||||||||||||||||||||||||
| 28 | QGraphicsItem *childParent = itemChild->parentItem(); | - | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | if (childParent
| 0 | ||||||||||||||||||||||||
| 31 | QGraphicsWidget *w = static_cast<QGraphicsWidget*>(layoutChild); | - | ||||||||||||||||||||||||
| 32 | QMessageLogger(__FILE__, 69, __PRETTY_FUNCTION__).warning("QGraphicsLayout::addChildLayout: widget %s \"%s\" in wrong parent; moved to correct parent", | - | ||||||||||||||||||||||||
| 33 | w->metaObject()->className(), w->objectName().toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | if (childParent != newParent
| 0 | ||||||||||||||||||||||||
| 37 | itemChild->setParentItem(newParent); never executed: itemChild->setParentItem(newParent); | 0 | ||||||||||||||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 39 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 40 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | void QGraphicsLayoutPrivate::getMargin(qreal *result, qreal userMargin, QStyle::PixelMetric pm) const | - | ||||||||||||||||||||||||
| 43 | { | - | ||||||||||||||||||||||||
| 44 | if (!result
| 0 | ||||||||||||||||||||||||
| 45 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 46 | const QGraphicsLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | QGraphicsLayoutItem *parent = q->parentLayoutItem(); | - | ||||||||||||||||||||||||
| 49 | if (userMargin >= 0.0
| 0 | ||||||||||||||||||||||||
| 50 | *result = userMargin; | - | ||||||||||||||||||||||||
| 51 | } never executed: else if (!parentend of block
| 0 | ||||||||||||||||||||||||
| 52 | *result = 0.0; | - | ||||||||||||||||||||||||
| 53 | } never executed: else if (parent->isLayout()end of block
| 0 | ||||||||||||||||||||||||
| 54 | *result = 0.0; | - | ||||||||||||||||||||||||
| 55 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 56 | *result = 0.0; | - | ||||||||||||||||||||||||
| 57 | if (QGraphicsItem *layoutParentItem = parentItem()
| 0 | ||||||||||||||||||||||||
| 58 | if (layoutParentItem->isWidget()
| 0 | ||||||||||||||||||||||||
| 59 | * never executed: result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);*result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0);never executed: *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0); | 0 | ||||||||||||||||||||||||
| 60 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 61 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 62 | } | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | Qt::LayoutDirection QGraphicsLayoutPrivate::visualDirection() const | - | ||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||
| 66 | if (QGraphicsItem *maybeWidget = parentItem()
| 0 | ||||||||||||||||||||||||
| 67 | if (maybeWidget->isWidget()
| 0 | ||||||||||||||||||||||||
| 68 | return never executed: static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection();never executed: return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection(); | 0 | ||||||||||||||||||||||||
| 69 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 70 | return never executed: QApplication::layoutDirection();return QApplication::layoutDirection();never executed: return QApplication::layoutDirection(); | 0 | ||||||||||||||||||||||||
| 71 | } | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem *layoutItem) | - | ||||||||||||||||||||||||
| 74 | { | - | ||||||||||||||||||||||||
| 75 | if (!lay
| 0 | ||||||||||||||||||||||||
| 76 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | for (int i = lay->count() - 1; i >= 0
| 0 | ||||||||||||||||||||||||
| 79 | QGraphicsLayoutItem *child = lay->itemAt(i); | - | ||||||||||||||||||||||||
| 80 | if (child
| 0 | ||||||||||||||||||||||||
| 81 | if (removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem)
| 0 | ||||||||||||||||||||||||
| 82 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 83 | } never executed: else if (child == layoutItemend of block
| 0 | ||||||||||||||||||||||||
| 84 | lay->removeAt(i); | - | ||||||||||||||||||||||||
| 85 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 86 | } | - | ||||||||||||||||||||||||
| 87 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 88 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 89 | } | - | ||||||||||||||||||||||||
| 90 | void QGraphicsLayoutPrivate::addChildLayoutItem(QGraphicsLayoutItem *layoutItem) | - | ||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||
| 92 | QGraphicsLayout * const q = q_func(); | - | ||||||||||||||||||||||||
| 93 | if (QGraphicsLayoutItem *maybeLayout = layoutItem->parentLayoutItem()
| 0 | ||||||||||||||||||||||||
| 94 | if (maybeLayout->isLayout()
| 0 | ||||||||||||||||||||||||
| 95 | removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem); never executed: removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem); | 0 | ||||||||||||||||||||||||
| 96 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 97 | layoutItem->setParentLayoutItem(q); | - | ||||||||||||||||||||||||
| 98 | if (layoutItem->isLayout()
| 0 | ||||||||||||||||||||||||
| 99 | if (QGraphicsItem *parItem = parentItem()
| 0 | ||||||||||||||||||||||||
| 100 | static_cast<QGraphicsLayout*>(layoutItem)->d_func()->reparentChildItems(parItem); | - | ||||||||||||||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 102 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 103 | if (QGraphicsItem *item = layoutItem->graphicsItem()
| 0 | ||||||||||||||||||||||||
| 104 | QGraphicsItem *newParent = parentItem(); | - | ||||||||||||||||||||||||
| 105 | QGraphicsItem *oldParent = item->parentItem(); | - | ||||||||||||||||||||||||
| 106 | if (oldParent == newParent
| 0 | ||||||||||||||||||||||||
| 107 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | if (oldParent
| 0 | ||||||||||||||||||||||||
| 111 | QGraphicsWidget *w = static_cast<QGraphicsWidget*>(item); | - | ||||||||||||||||||||||||
| 112 | QMessageLogger(__FILE__, 161, __PRETTY_FUNCTION__).warning("QGraphicsLayout::addChildLayoutItem: %s \"%s\" in wrong parent; moved to correct parent", | - | ||||||||||||||||||||||||
| 113 | w->metaObject()->className(), w->objectName().toLocal8Bit().constData()); | - | ||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | item->setParentItem(newParent); | - | ||||||||||||||||||||||||
| 118 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 119 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 120 | } | - | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | void QGraphicsLayoutPrivate::activateRecursive(QGraphicsLayoutItem *item) | - | ||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||
| 124 | if (item->isLayout()
| 0 | ||||||||||||||||||||||||
| 125 | QGraphicsLayout *layout = static_cast<QGraphicsLayout *>(item); | - | ||||||||||||||||||||||||
| 126 | if (layout->d_func()->activated
| 0 | ||||||||||||||||||||||||
| 127 | if (QGraphicsLayout::instantInvalidatePropagation()
| 0 | ||||||||||||||||||||||||
| 128 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 129 | } else { | - | ||||||||||||||||||||||||
| 130 | layout->invalidate(); | - | ||||||||||||||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 132 | } | - | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | for (int i = layout->count() - 1; i >= 0
| 0 | ||||||||||||||||||||||||
| 135 | QGraphicsLayoutItem *childItem = layout->itemAt(i); | - | ||||||||||||||||||||||||
| 136 | if (childItem
| 0 | ||||||||||||||||||||||||
| 137 | activateRecursive(childItem); never executed: activateRecursive(childItem); | 0 | ||||||||||||||||||||||||
| 138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 139 | layout->d_func()->activated = true; | - | ||||||||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |