Line | Source Code | Coverage |
---|
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; ++i) { evaluated: i < n yes Evaluation Count:150 | yes Evaluation Count:261 |
| 150-261 |
19 | QGraphicsLayoutItem *layoutChild = q->itemAt(i); | - |
20 | if (!layoutChild) { partially evaluated: !layoutChild no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
21 | | - |
22 | continue; never executed: continue; | 0 |
23 | } | - |
24 | if (layoutChild->isLayout()) { evaluated: layoutChild->isLayout() yes Evaluation Count:32 | yes Evaluation Count:118 |
| 32-118 |
25 | QGraphicsLayout *l = static_cast<QGraphicsLayout*>(layoutChild); | - |
26 | l->d_func()->reparentChildItems(newParent); | - |
27 | } else if (QGraphicsItem *itemChild = layoutChild->graphicsItem()){ executed: } Execution Count:32 partially evaluated: QGraphicsItem *itemChild = layoutChild->graphicsItem() yes Evaluation Count:118 | no Evaluation Count:0 |
| 0-118 |
28 | QGraphicsItem *childParent = itemChild->parentItem(); | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | if (childParent != newParent) evaluated: childParent != newParent yes Evaluation Count:82 | yes Evaluation Count:36 |
| 36-82 |
37 | itemChild->setParentItem(newParent); executed: itemChild->setParentItem(newParent); Execution Count:82 | 82 |
38 | } executed: } Execution Count:118 | 118 |
39 | } | - |
40 | } executed: } Execution Count:261 | 261 |
41 | | - |
42 | void QGraphicsLayoutPrivate::getMargin(qreal *result, qreal userMargin, QStyle::PixelMetric pm) const | - |
43 | { | - |
44 | if (!result) partially evaluated: !result no Evaluation Count:0 | yes Evaluation Count:8124 |
| 0-8124 |
45 | return; | 0 |
46 | const QGraphicsLayout * const q = q_func(); | - |
47 | | - |
48 | QGraphicsLayoutItem *parent = q->parentLayoutItem(); | - |
49 | if (userMargin >= 0.0) { evaluated: userMargin >= 0.0 yes Evaluation Count:5128 | yes Evaluation Count:2996 |
| 2996-5128 |
50 | *result = userMargin; | - |
51 | } else if (!parent) { evaluated: !parent yes Evaluation Count:528 | yes Evaluation Count:2468 |
executed: } Execution Count:5128 | 528-5128 |
52 | *result = 0.0; | - |
53 | } else if (parent->isLayout()) { evaluated: parent->isLayout() yes Evaluation Count:1684 | yes Evaluation Count:784 |
executed: } Execution Count:528 | 528-1684 |
54 | *result = 0.0; | - |
55 | } else { executed: } Execution Count:1684 | 1684 |
56 | *result = 0.0; | - |
57 | if (QGraphicsItem *layoutParentItem = parentItem()) { partially evaluated: QGraphicsItem *layoutParentItem = parentItem() yes Evaluation Count:784 | no Evaluation Count:0 |
| 0-784 |
58 | if (layoutParentItem->isWidget()) partially evaluated: layoutParentItem->isWidget() yes Evaluation Count:784 | no Evaluation Count:0 |
| 0-784 |
59 | *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0); executed: *result = (qreal)static_cast<QGraphicsWidget*>(layoutParentItem)->style()->pixelMetric(pm, 0); Execution Count:784 | 784 |
60 | } executed: } Execution Count:784 | 784 |
61 | } executed: } Execution Count:784 | 784 |
62 | } | - |
63 | | - |
64 | Qt::LayoutDirection QGraphicsLayoutPrivate::visualDirection() const | - |
65 | { | - |
66 | if (QGraphicsItem *maybeWidget = parentItem()) { evaluated: QGraphicsItem *maybeWidget = parentItem() yes Evaluation Count:494 | yes Evaluation Count:3 |
| 3-494 |
67 | if (maybeWidget->isWidget()) partially evaluated: maybeWidget->isWidget() yes Evaluation Count:494 | no Evaluation Count:0 |
| 0-494 |
68 | return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection(); executed: return static_cast<QGraphicsWidget*>(maybeWidget)->layoutDirection(); Execution Count:494 | 494 |
69 | } | 0 |
70 | return QApplication::layoutDirection(); executed: return QApplication::layoutDirection(); Execution Count:3 | 3 |
71 | } | - |
72 | | - |
73 | static bool removeLayoutItemFromLayout(QGraphicsLayout *lay, QGraphicsLayoutItem *layoutItem) | - |
74 | { | - |
75 | if (!lay) partially evaluated: !lay no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
76 | return false; never executed: return false; | 0 |
77 | | - |
78 | for (int i = lay->count() - 1; i >= 0; --i) { partially evaluated: i >= 0 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
79 | QGraphicsLayoutItem *child = lay->itemAt(i); | - |
80 | if (child && child->isLayout()) { partially evaluated: child yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: child->isLayout() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
81 | if (removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem)) never evaluated: removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(child), layoutItem) | 0 |
82 | return true; never executed: return true; | 0 |
83 | } else if (child == layoutItem) { evaluated: child == layoutItem yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-3 |
84 | lay->removeAt(i); | - |
85 | return true; executed: return true; Execution Count:3 | 3 |
86 | } | - |
87 | } | - |
88 | 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()) { evaluated: QGraphicsLayoutItem *maybeLayout = layoutItem->parentLayoutItem() yes Evaluation Count:3 | yes Evaluation Count:1339 |
| 3-1339 |
94 | if (maybeLayout->isLayout()) partially evaluated: maybeLayout->isLayout() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
95 | removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem); executed: removeLayoutItemFromLayout(static_cast<QGraphicsLayout*>(maybeLayout), layoutItem); Execution Count:3 | 3 |
96 | } executed: } Execution Count:3 | 3 |
97 | layoutItem->setParentLayoutItem(q); | - |
98 | if (layoutItem->isLayout()) { evaluated: layoutItem->isLayout() yes Evaluation Count:219 | yes Evaluation Count:1123 |
| 219-1123 |
99 | if (QGraphicsItem *parItem = parentItem()) { evaluated: QGraphicsItem *parItem = parentItem() yes Evaluation Count:42 | yes Evaluation Count:177 |
| 42-177 |
100 | static_cast<QGraphicsLayout*>(layoutItem)->d_func()->reparentChildItems(parItem); | - |
101 | } executed: } Execution Count:42 | 42 |
102 | } else { executed: } Execution Count:219 | 219 |
103 | if (QGraphicsItem *item = layoutItem->graphicsItem()) { evaluated: QGraphicsItem *item = layoutItem->graphicsItem() yes Evaluation Count:1120 | yes Evaluation Count:3 |
| 3-1120 |
104 | QGraphicsItem *newParent = parentItem(); | - |
105 | QGraphicsItem *oldParent = item->parentItem(); | - |
106 | if (oldParent == newParent || !newParent) evaluated: oldParent == newParent yes Evaluation Count:697 | yes Evaluation Count:423 |
evaluated: !newParent yes Evaluation Count:38 | yes Evaluation Count:385 |
| 38-697 |
107 | return; executed: return; Execution Count:735 | 735 |
108 | item->setParentItem(newParent); | - |
109 | } executed: } Execution Count:385 | 385 |
110 | } executed: } Execution Count:388 | 388 |
111 | } | - |
112 | | - |
113 | void QGraphicsLayoutPrivate::activateRecursive(QGraphicsLayoutItem *item) | - |
114 | { | - |
115 | if (item->isLayout()) { evaluated: item->isLayout() yes Evaluation Count:323 | yes Evaluation Count:852 |
| 323-852 |
116 | QGraphicsLayout *layout = static_cast<QGraphicsLayout *>(item); | - |
117 | if (layout->d_func()->activated) { evaluated: layout->d_func()->activated yes Evaluation Count:71 | yes Evaluation Count:252 |
| 71-252 |
118 | if (QGraphicsLayout::instantInvalidatePropagation()) { partially evaluated: QGraphicsLayout::instantInvalidatePropagation() no Evaluation Count:0 | yes Evaluation Count:71 |
| 0-71 |
119 | return; | 0 |
120 | } else { | - |
121 | layout->invalidate(); | - |
122 | } executed: } Execution Count:71 | 71 |
123 | } | - |
124 | | - |
125 | for (int i = layout->count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:923 | yes Evaluation Count:323 |
| 323-923 |
126 | QGraphicsLayoutItem *childItem = layout->itemAt(i); | - |
127 | if (childItem) partially evaluated: childItem yes Evaluation Count:923 | no Evaluation Count:0 |
| 0-923 |
128 | activateRecursive(childItem); executed: activateRecursive(childItem); Execution Count:923 | 923 |
129 | } executed: } Execution Count:923 | 923 |
130 | layout->d_func()->activated = true; | - |
131 | } executed: } Execution Count:323 | 323 |
132 | } executed: } Execution Count:1175 | 1175 |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
| | |