summaryrefslogtreecommitdiffstats
path: root/src/charts/linechart/linechartitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/charts/linechart/linechartitem.cpp')
-rw-r--r--src/charts/linechart/linechartitem.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp
index c2c3c694..1da16e07 100644
--- a/src/charts/linechart/linechartitem.cpp
+++ b/src/charts/linechart/linechartitem.cpp
@@ -58,6 +58,7 @@ LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
connect(series->d_func(), &QXYSeriesPrivate::seriesUpdated,
this, &LineChartItem::handleSeriesUpdated);
connect(series, &QXYSeries::lightMarkerChanged, this, &LineChartItem::handleSeriesUpdated);
+ connect(series, &QXYSeries::selectedLightMarkerChanged, this, &LineChartItem::handleSeriesUpdated);
connect(series, &QXYSeries::markerSizeChanged, this, &LineChartItem::handleSeriesUpdated);
connect(series, &QXYSeries::visibleChanged, this, &LineChartItem::handleSeriesUpdated);
connect(series, &QXYSeries::opacityChanged, this, &LineChartItem::handleSeriesUpdated);
@@ -322,7 +323,9 @@ void LineChartItem::updateGeometry()
// For mouse interactivity, we have to add the rects *after* the 'createStroke',
// as we don't need the outline - we need it filled up.
- if (!m_series->lightMarker().isNull()) {
+ if (!m_series->lightMarker().isNull()
+ || (!m_series->selectedLightMarker().isNull()
+ && !m_series->selectedPoints().isEmpty())) {
// +1, +2: a margin to guarantee we cover all of the pixmap
qreal markerHalfSize = (m_markerSize / 2.0) + 1;
qreal markerSize = m_markerSize + 2;
@@ -449,8 +452,10 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
int pointLabelsOffset = m_linePen.width() / 2;
- // Draw markers if a marker has been set (set to QImage() to disable)
- if (!m_series->lightMarker().isNull()) {
+ // Draw markers if a marker or marker for selected points only has been
+ // set (set to QImage() to disable)
+ if (!m_series->lightMarker().isNull() || (!m_series->selectedLightMarker().isNull()
+ && !m_series->selectedPoints().isEmpty())) {
const QImage &marker = m_series->lightMarker();
const QImage &selectedMarker = m_series->selectedLightMarker();
qreal markerHalfSize = m_markerSize / 2.0;
@@ -461,7 +466,7 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
// light markers are independent features. Therefore m_pointsVisible
// is not used here as light markers are drawn if lightMarker is not null.
// However points visibility configuration can be still used here.
- bool drawPoint = true;
+ bool drawPoint = !m_series->lightMarker().isNull();
if (m_pointsConfiguration.contains(i)) {
const auto &conf = m_pointsConfiguration[i];