summaryrefslogtreecommitdiffstats
path: root/src/charts/axis/chartaxiselement.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-09-08 17:56:12 +0300
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2015-09-09 06:54:48 +0000
commitacb3f8c5f190ebda7032127ba0ed80fcb4483fcf (patch)
treede9993f8267aadedcd911979c662b4f8ee079d04 /src/charts/axis/chartaxiselement.cpp
parent891ed0097501b4fb27cda2f6ae97e739c44ea4e6 (diff)
Make category axis label positioning at value work for polar charts
Task-number: QTRD-3515 Change-Id: Icd38469386c7fc923047533f2a25b726f2f6caa5 Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
Diffstat (limited to 'src/charts/axis/chartaxiselement.cpp')
-rw-r--r--src/charts/axis/chartaxiselement.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/charts/axis/chartaxiselement.cpp b/src/charts/axis/chartaxiselement.cpp
index 1667f0c7..34d7e840 100644
--- a/src/charts/axis/chartaxiselement.cpp
+++ b/src/charts/axis/chartaxiselement.cpp
@@ -20,6 +20,7 @@
#include <private/qabstractaxis_p.h>
#include <private/chartpresenter_p.h>
#include <private/abstractchartlayout_p.h>
+#include <QtCharts/QCategoryAxis>
#include <QtCore/QtMath>
#include <QtCore/QDateTime>
#include <QtGui/QTextDocument>
@@ -105,6 +106,13 @@ void ChartAxisElement::connectSlots()
this, SLOT(handleMinorGridVisibleChanged(bool)));
QObject::connect(axis(), SIGNAL(minorGridLinePenChanged(const QPen&)),
this, SLOT(handleMinorGridPenChanged(const QPen&)));
+
+ if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
+ QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
+ QObject::connect(categoryAxis,
+ SIGNAL(labelsPositionChanged(QCategoryAxis::AxisLabelsPosition)),
+ this, SLOT(handleLabelsPositionChanged()));
+ }
}
void ChartAxisElement::handleArrowVisibleChanged(bool visible)
@@ -127,6 +135,12 @@ void ChartAxisElement::handleMinorGridVisibleChanged(bool visible)
m_minorGrid->setVisible(visible);
}
+void ChartAxisElement::handleLabelsPositionChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
{
QGraphicsLayoutItem::updateGeometry();