| 271 | } |
| 272 | |
| 273 | void Datapicker::handleAspectAdded(const AbstractAspect* aspect) { |
| 274 | const auto* addedPoint = qobject_cast<const DatapickerPoint*>(aspect); |
| 275 | const auto* curve = qobject_cast<const DatapickerCurve*>(aspect); |
| 276 | if (addedPoint) |
| 277 | handleChildAspectAdded(addedPoint); |
| 278 | else if (curve) { |
| 279 | const auto count = childCount<DatapickerCurve>(AbstractAspect::ChildIndexFlag::IncludeHidden); |
| 280 | curve->symbol()->setColor(themeColorPalette(count - 1)); |
| 281 | connect(m_image, &DatapickerImage::axisPointsChanged, curve, &DatapickerCurve::updatePoints); |
| 282 | connect(m_image, &DatapickerImage::axisPointsRemoved, curve, &DatapickerCurve::updatePoints); |
| 283 | auto points = curve->children<DatapickerPoint>(ChildIndexFlag::IncludeHidden); |
| 284 | for (auto* point : points) |
| 285 | handleChildAspectAdded(point); |
| 286 | } else |
| 287 | return; |
| 288 | |
| 289 | qreal zVal = 0; |
| 290 | const auto& points = m_image->children<DatapickerPoint>(ChildIndexFlag::IncludeHidden); |
| 291 | for (auto* point : points) |
| 292 | point->graphicsItem()->setZValue(zVal++); |
| 293 | |
| 294 | for (const auto* curve : children<DatapickerCurve>()) { |
| 295 | for (auto* point : curve->children<DatapickerPoint>(ChildIndexFlag::IncludeHidden)) |
| 296 | point->graphicsItem()->setZValue(zVal++); |
| 297 | } |
| 298 | |
| 299 | Q_EMIT requestUpdateActions(); |
| 300 | } |
| 301 | |
| 302 | void Datapicker::handleChildAspectAboutToBeRemoved(const AbstractAspect* aspect) { |
| 303 | const auto* removedPoint = qobject_cast<const DatapickerPoint*>(aspect); |
nothing calls this directly
no test coverage detected