summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHatem ElKharashy <hatem.elkharashy@qt.io>2021-10-15 13:48:32 +0300
committerHatem ElKharashy <hatem.elkharashy@qt.io>2021-10-15 14:07:11 +0300
commit968e128f3379514b476ed21dd92cf2ac8f9f861d (patch)
treeb79ec3df441b045262824ecf2602f59eecace2e0 /src
parentf78e11381f2dedcab4bda44e52b3c75d810766c4 (diff)
Fix axes not being removed when shared
Switching axes that is shared between multiple series causes them not to be removed. The axis must be detached from the series when removed so that it can be removed in the next iteration. Fixes: QTBUG-81278 Pick-to: 6.2 5.15 Change-Id: Iba9e027333ed924ff985e36184f7e6d49d2124cf Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/chartsqml2/declarativechart.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp
index 82410cb2..8a55feb4 100644
--- a/src/chartsqml2/declarativechart.cpp
+++ b/src/chartsqml2/declarativechart.cpp
@@ -652,9 +652,12 @@ void DeclarativeChart::seriesAxisAttachHelper(QAbstractSeries *series, QAbstract
{
if (!series->attachedAxes().contains(axis)) {
// Remove & delete old axes that are not attached to any other series
+ // Detach old axis from series so that if it is shared with other series
+ // It can be deleted.
foreach (QAbstractAxis* oldAxis, m_chart->axes(orientation, series)) {
bool otherAttachments = false;
if (oldAxis != axis) {
+ series->detachAxis(oldAxis);
foreach (QAbstractSeries *oldSeries, m_chart->series()) {
if (oldSeries != series && oldSeries->attachedAxes().contains(oldAxis)) {
otherAttachments = true;