summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:22 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2022-11-10 22:42:22 +0200
commite30be213e483f2d6f3c40af0cbdc11a8e92e2026 (patch)
treeba9e1932c4989e8fd1f45662ffcdda2eae8e4b5c
parent055c6d6e49c5ea369990e7078fd534392a0ba6b9 (diff)
parentb8671f5a150a3a27180e0336a7b692746bdbe40f (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
-rw-r--r--.qmake.conf2
-rw-r--r--src/charts/chartpresenter.cpp2
-rw-r--r--src/charts/domain/abstractdomain.cpp3
-rw-r--r--src/charts/layout/abstractchartlayout.cpp15
-rw-r--r--src/charts/piechart/qpieslice.cpp2
-rw-r--r--src/chartsqml2/declarativechart.cpp8
6 files changed, 24 insertions, 8 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 03db297a..560f538f 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.15.7
+MODULE_VERSION = 5.15.8
diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp
index 12d3958d..f482adf3 100644
--- a/src/charts/chartpresenter.cpp
+++ b/src/charts/chartpresenter.cpp
@@ -98,7 +98,7 @@ void ChartPresenter::setFixedGeometry(const QRectF &rect)
void ChartPresenter::setGeometry(const QRectF rect)
{
- if (m_rect != rect) {
+ if (rect.isValid() && m_rect != rect) {
m_rect = rect;
if (!m_fixedRect.isNull())
return;
diff --git a/src/charts/domain/abstractdomain.cpp b/src/charts/domain/abstractdomain.cpp
index 36e4974a..be50d7cf 100644
--- a/src/charts/domain/abstractdomain.cpp
+++ b/src/charts/domain/abstractdomain.cpp
@@ -58,6 +58,9 @@ AbstractDomain::~AbstractDomain()
void AbstractDomain::setSize(const QSizeF &size)
{
+ if (!size.isValid())
+ return;
+
if (m_size != size) {
m_size=size;
emit updated();
diff --git a/src/charts/layout/abstractchartlayout.cpp b/src/charts/layout/abstractchartlayout.cpp
index fd3c5e97..c612d197 100644
--- a/src/charts/layout/abstractchartlayout.cpp
+++ b/src/charts/layout/abstractchartlayout.cpp
@@ -53,6 +53,7 @@ void AbstractChartLayout::setGeometry(const QRectF &rect)
{
if (!rect.isValid())
return;
+
// If the chart has a fixed geometry then don't update visually
const bool updateLayout = (!m_presenter->isFixedGeometry() || m_presenter->geometry() == rect);
if (m_presenter->chart()->isVisible()) {
@@ -73,12 +74,14 @@ void AbstractChartLayout::setGeometry(const QRectF &rect)
contentGeometry = calculateAxisGeometry(contentGeometry, axes, updateLayout);
- m_presenter->setGeometry(contentGeometry);
- if (updateLayout) {
- if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
- static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
- else
- static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
+ if (contentGeometry.isValid()) {
+ m_presenter->setGeometry(contentGeometry);
+ if (updateLayout) {
+ if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
+ static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
+ else
+ static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
+ }
}
}
diff --git a/src/charts/piechart/qpieslice.cpp b/src/charts/piechart/qpieslice.cpp
index f36f93a3..8ed844b6 100644
--- a/src/charts/piechart/qpieslice.cpp
+++ b/src/charts/piechart/qpieslice.cpp
@@ -108,11 +108,13 @@ QT_CHARTS_BEGIN_NAMESPACE
/*!
\property QPieSlice::label
\brief The label of the slice.
+ \note The string can be HTML formatted.
\sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
*/
/*!
\qmlproperty string PieSlice::label
The label of the slice.
+ \note The string can be HTML formatted.
*/
/*!
diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp
index a58e67c7..84fc9871 100644
--- a/src/chartsqml2/declarativechart.cpp
+++ b/src/chartsqml2/declarativechart.cpp
@@ -61,6 +61,7 @@
#include <QtCore/QTimer>
#include <QtCore/QThread>
#include <QtQuick/QQuickWindow>
+#include <QtWidgets/QGraphicsLayout>
QT_CHARTS_BEGIN_NAMESPACE
@@ -632,9 +633,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;
@@ -1496,6 +1500,10 @@ QPointF DeclarativeChart::mapToPosition(const QPointF &value, QAbstractSeries *s
void DeclarativeChart::setPlotArea(const QRectF &rect)
{
m_chart->setPlotArea(rect);
+
+ // If plotArea is set inside ChartView, contentGeometry is updated too early and we end up
+ // with incorrect plotArea. Invalidate the layout to correct the geometry.
+ m_chart->layout()->invalidate();
}
QT_CHARTS_END_NAMESPACE