Changeset View
Changeset View
Standalone View
Standalone View
src/backend/worksheet/plots/cartesian/CartesianPlot.cpp
Context not available. | |||||
1396 | 1396 | | |||
---|---|---|---|---|---|
1397 | updateLegend(); | 1397 | updateLegend(); | ||
1398 | } | 1398 | } | ||
1399 | // if an element is hovered, the curves which are handled manually in this class | ||||
1400 | // must be unhovered | ||||
1401 | const WorksheetElement* element = dynamic_cast<const WorksheetElement*>(child); | ||||
1402 | if (element) | ||||
1403 | connect(element, &WorksheetElement::hovered, | ||||
1404 | this, &CartesianPlot::childHovered); | ||||
1399 | } | 1405 | } | ||
1400 | 1406 | | |||
1401 | if (!isLoading()) { | 1407 | if (!isLoading()) { | ||
Context not available. | |||||
1464 | } | 1470 | } | ||
1465 | } | 1471 | } | ||
1466 | 1472 | | |||
1473 | /*! | ||||
1474 | * \brief CartesianPlot::childHovered | ||||
1475 | * Unhover all curves, when another child is hovered. The hover handling for the curves is done in its parent (CartesianPlot), | ||||
1476 | * because the hover should set when the curve is hovered and not just the bounding rect (for more see hoverMoveEvent) | ||||
1477 | */ | ||||
1478 | void CartesianPlot::childHovered() { | ||||
1479 | Q_D(CartesianPlot); | ||||
1480 | bool curveSender = dynamic_cast<XYCurve*>(QObject::sender()) != nullptr; | ||||
1481 | if (!d->isSelected()) { | ||||
1482 | if (d->m_hovered) | ||||
1483 | d->m_hovered = false; | ||||
1484 | d->update(); | ||||
1485 | } | ||||
1486 | if (!curveSender) { | ||||
1487 | for (auto curve: children<XYCurve>()) | ||||
1488 | curve->setHover(false); | ||||
1489 | } | ||||
1490 | } | ||||
1491 | | ||||
1467 | void CartesianPlot::updateLegend() { | 1492 | void CartesianPlot::updateLegend() { | ||
1468 | if (m_legend) | 1493 | if (m_legend) | ||
1469 | m_legend->retransform(); | 1494 | m_legend->retransform(); | ||
Context not available. | |||||
2690 | update(); | 2715 | update(); | ||
2691 | } else if (mouseMode == CartesianPlot::MouseMode::SelectionMode) { | 2716 | } else if (mouseMode == CartesianPlot::MouseMode::SelectionMode) { | ||
2692 | // hover the nearest curve to the mousepointer | 2717 | // hover the nearest curve to the mousepointer | ||
2718 | // hovering curves is implemented in the parent, because no ignoreEvent() exist | ||||
2719 | // for it. Checking all curves and hover the first | ||||
2693 | bool curve_hovered = false; | 2720 | bool curve_hovered = false; | ||
2694 | QVector<XYCurve*> curves = q->children<XYCurve>(); | 2721 | QVector<XYCurve*> curves = q->children<XYCurve>(); | ||
2695 | for (int i=curves.count() - 1; i >= 0; i--){ // because the last curve is above the other curves | 2722 | for (int i=curves.count() - 1; i >= 0; i--){ // because the last curve is above the other curves | ||
Context not available. |