##// END OF EJS Templates
No longer automatically disable QDateTimeAxis on ARM platforms...
No longer automatically disable QDateTimeAxis on ARM platforms QDateTimeAxis is now only disabled on platforms that define qreal as float. Change-Id: I08d393d328c972d74b27bd218e4cd01e844800c9 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com> Reviewed-by: Mika Salmela <mika.salmela@theqtcompany.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2854:46147b040d06
r2861:21c113d296ef
Show More
verticalaxis.cpp
398 lines | 17.7 KiB | text/x-c | CppLexer
/ src / charts / axis / verticalaxis.cpp
Miikka Heikkinen
Updated license...
r2854 /****************************************************************************
Michal Klocek
Refactors axis updateGeometry handling...
r2111 **
Miikka Heikkinen
Updated license...
r2854 ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Michal Klocek
Refactors axis updateGeometry handling...
r2111 **
Miikka Heikkinen
Updated license...
r2854 ** This file is part of the Qt Charts module of the Qt Toolkit.
Michal Klocek
Refactors axis updateGeometry handling...
r2111 **
Miikka Heikkinen
Updated license...
r2854 ** $QT_BEGIN_LICENSE:GPL$
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
Miikka Heikkinen
Updated license...
r2854 ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Michal Klocek
Refactors axis updateGeometry handling...
r2111 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
Miikka Heikkinen
Updated license...
r2854 ****************************************************************************/
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Titta Heikkala
Fix include syntax...
r2714 #include <private/verticalaxis_p.h>
#include <QtCharts/QAbstractAxis>
#include <private/chartpresenter_p.h>
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 #include <QtCharts/QCategoryAxis>
Titta Heikkala
Fix include syntax...
r2714 #include <QtCore/QDebug>
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Miikka Heikkinen
Add Polar chart support...
r2483 VerticalAxis::VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
: CartesianChartAxis(axis, item, intervalAxis)
Michal Klocek
Refactors axis updateGeometry handling...
r2111 {
}
VerticalAxis::~VerticalAxis()
{
}
void VerticalAxis::updateGeometry()
{
Miikka Heikkinen
Add Polar chart support...
r2483 const QVector<qreal> &layout = ChartAxisElement::layout();
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Titta Heikkala
Fix QLogValueAxis update...
r2759 if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue)
Jani Honkonen
src folder: another massive victory for coding style police
r2131 return;
Michal Klocek
Refactors axis updateGeometry handling...
r2111
QStringList labelList = labels();
QList<QGraphicsItem *> labels = labelItems();
Miikka Heikkinen
Add Polar chart support...
r2483 QList<QGraphicsItem *> arrow = arrowItems();
Miikka Heikkinen
Added HTML support for various text items...
r2539 QGraphicsTextItem *title = titleItem();
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Q_ASSERT(labels.size() == labelList.size());
Q_ASSERT(layout.size() == labelList.size());
Jani Honkonen
src folder: another massive victory for coding style police
r2131 const QRectF &axisRect = axisGeometry();
const QRectF &gridRect = gridGeometry();
Michal Klocek
Refactors axis updateGeometry handling...
r2111
qreal height = axisRect.bottom();
Michal Klocek
Updates axis drawing code...
r2133 //arrow
Miikka Heikkinen
Add Polar chart support...
r2483 QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0));
Michal Klocek
Updates axis drawing code...
r2133
//arrow position
Miikka Heikkinen
Add Polar chart support...
r2483 if (axis()->alignment() == Qt::AlignLeft)
arrowItem->setLine(axisRect.right(), gridRect.top(), axisRect.right(), gridRect.bottom());
else if (axis()->alignment() == Qt::AlignRight)
arrowItem->setLine(axisRect.left(), gridRect.top(), axisRect.left(), gridRect.bottom());
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Michal Klocek
Adds consider title boundary for axis label wrapping
r2148 //title
Miikka Heikkinen
Fix axis geometry when there is no axis title...
r2415 QRectF titleBoundingRect;
Miikka Heikkinen
Add Polar chart support...
r2483 QString titleText = axis()->titleText();
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 qreal availableSpace = axisRect.width() - labelPadding();
Miikka Heikkinen
Add Polar chart support...
r2483 if (!titleText.isEmpty() && titleItem()->isVisible()) {
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 availableSpace -= titlePadding() * 2.0;
Titta Heikkala
Qt Charts project file structure change...
r2712 qreal minimumLabelWidth = ChartPresenter::textBoundingRect(axis()->labelsFont(),
QStringLiteral("...")).width();
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 qreal titleSpace = availableSpace - minimumLabelWidth;
Titta Heikkala
Fix long labels visibility for QBarChart...
r2604 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(90.0),
titleSpace, gridRect.height(),
titleBoundingRect));
Titta Heikkala
Fix multiline alignment...
r2607 title->setTextWidth(titleBoundingRect.height());
Michal Klocek
Adds consider title boundary for axis label wrapping
r2148
Miikka Heikkinen
Fix axis geometry when there is no axis title...
r2415 titleBoundingRect = title->boundingRect();
QPointF center = gridRect.center() - titleBoundingRect.center();
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 if (axis()->alignment() == Qt::AlignLeft)
title->setPos(axisRect.left() - titleBoundingRect.width() / 2.0 + titleBoundingRect.height() / 2.0 + titlePadding(), center.y());
else if (axis()->alignment() == Qt::AlignRight)
title->setPos(axisRect.right() - titleBoundingRect.width() / 2.0 - titleBoundingRect.height() / 2.0 - titlePadding(), center.y());
Miikka Heikkinen
Fix axis geometry when there is no axis title...
r2415 title->setTransformOriginPoint(titleBoundingRect.center());
Michal Klocek
Adds consider title boundary for axis label wrapping
r2148 title->setRotation(270);
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540
availableSpace -= titleBoundingRect.height();
Michal Klocek
Adds consider title boundary for axis label wrapping
r2148 }
Titta Heikkala
Fix QLogValueAxis update...
r2759 if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue)
return;
QList<QGraphicsItem *> lines = gridItems();
QList<QGraphicsItem *> shades = shadeItems();
Titta Heikkala
Added minor ticks to value axis...
r2795 QList<QGraphicsItem *> minorLines = minorGridItems();
QList<QGraphicsItem *> minorArrows = minorArrowItems();
Titta Heikkala
Fix QLogValueAxis update...
r2759
Michal Klocek
Refactors axis updateGeometry handling...
r2111 for (int i = 0; i < layout.size(); ++i) {
Michal Klocek
Updates axis drawing code...
r2133 //items
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i));
Miikka Heikkinen
Add Polar chart support...
r2483 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrow.at(i + 1));
Miikka Heikkinen
Added HTML support for various text items...
r2539 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
Michal Klocek
Refactors axis updateGeometry handling...
r2111
//grid line
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
gridItem->setLine(gridRect.left(), gridRect.top() + gridRect.bottom() - layout[i],
gridRect.right(), gridRect.top() + gridRect.bottom() - layout[i]);
} else {
gridItem->setLine(gridRect.left(), layout[i], gridRect.right(), layout[i]);
}
Michal Klocek
Refactors axis updateGeometry handling...
r2111
Michal Klocek
Updates axis drawing code...
r2133 //label text wrapping
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 QString text;
if (axis()->isReverse() && axis()->type() != QAbstractAxis::AxisTypeCategory)
text = labelList.at(labelList.count() - i - 1);
else
text = labelList.at(i);
Miikka Heikkinen
Fix multiline axis label positioning....
r2534 QRectF boundingRect;
Titta Heikkala
Fix long labels visibility for QBarChart...
r2604 // don't truncate empty labels
if (text.isEmpty()) {
labelItem->setHtml(text);
} else {
qreal labelHeight = (axisRect.height() / layout.count()) - (2 * labelPadding());
Titta Heikkala
Fix multiline alignment...
r2607 QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
axis()->labelsAngle(),
availableSpace,
labelHeight, boundingRect);
labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
truncatedText).width());
labelItem->setHtml(truncatedText);
Titta Heikkala
Fix long labels visibility for QBarChart...
r2604 }
Miikka Heikkinen
Fix axis sizehints when labels are angled...
r2412
Michal Klocek
Updates axis drawing code...
r2133 //label transformation origin point
Jani Honkonen
src folder: another massive victory for coding style police
r2131 const QRectF &rect = labelItem->boundingRect();
Michal Klocek
Refactors axis updateGeometry handling...
r2111 QPointF center = rect.center();
labelItem->setTransformOriginPoint(center.x(), center.y());
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 qreal widthDiff = rect.width() - boundingRect.width();
Miikka Heikkinen
Fix checking for labels out of axis grid....
r2570 qreal heightDiff = rect.height() - boundingRect.height();
Michal Klocek
Refactors axis updateGeometry handling...
r2111
//ticks and label position
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 QPointF labelPos;
Miikka Heikkinen
Add Polar chart support...
r2483 if (axis()->alignment() == Qt::AlignLeft) {
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos = QPointF(axisRect.right() - rect.width() + (widthDiff / 2.0)
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 - labelPadding(),
gridRect.top() + gridRect.bottom()
- layout[layout.size() - i - 1] - center.y());
tickItem->setLine(axisRect.right() - labelPadding(),
gridRect.top() + gridRect.bottom() - layout[i],
axisRect.right(),
gridRect.top() + gridRect.bottom() - layout[i]);
} else {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos = QPointF(axisRect.right() - rect.width() + (widthDiff / 2.0)
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 - labelPadding(),
layout[i] - center.y());
tickItem->setLine(axisRect.right() - labelPadding(), layout[i],
axisRect.right(), layout[i]);
}
Miikka Heikkinen
Add Polar chart support...
r2483 } else if (axis()->alignment() == Qt::AlignRight) {
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
tickItem->setLine(axisRect.left(),
gridRect.top() + gridRect.bottom() - layout[i],
axisRect.left() + labelPadding(),
gridRect.top() + gridRect.bottom() - layout[i]);
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos = QPointF(axisRect.left() + labelPadding() - (widthDiff / 2.0),
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 gridRect.top() + gridRect.bottom()
- layout[layout.size() - i - 1] - center.y());
} else {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos = QPointF(axisRect.left() + labelPadding() - (widthDiff / 2.0),
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 layout[i] - center.y());
tickItem->setLine(axisRect.left(), layout[i],
axisRect.left() + labelPadding(), layout[i]);
}
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
Michal Klocek
Updates axis drawing code...
r2133
Miikka Heikkinen
Fix category axis label positioning....
r2446 //label in between
bool forceHide = false;
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 bool labelOnValue = false;
Miikka Heikkinen
Fix category axis label positioning....
r2446 if (intervalAxis() && (i + 1) != layout.size()) {
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 qreal lowerBound;
qreal upperBound;
if (axis()->isReverse()) {
lowerBound = qMax(gridRect.top() + gridRect.bottom() - layout[i + 1],
gridRect.top());
upperBound = qMin(gridRect.top() + gridRect.bottom() - layout[i],
gridRect.bottom());
} else {
lowerBound = qMin(layout[i], gridRect.bottom());
upperBound = qMax(layout[i + 1], gridRect.top());
}
Miikka Heikkinen
Fix category axis label positioning....
r2446 const qreal delta = lowerBound - upperBound;
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 if (axis()->type() != QAbstractAxis::AxisTypeCategory) {
// Hide label in case visible part of the category at the grid edge is too narrow
if (delta < boundingRect.height()
&& (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
forceHide = true;
} else {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos.setY(lowerBound - (delta / 2.0) - center.y());
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 }
Miikka Heikkinen
Fix category axis label positioning....
r2446 } else {
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionCenter) {
if (delta < boundingRect.height()
&& (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
forceHide = true;
} else {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos.setY(lowerBound - (delta / 2.0) - center.y());
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 }
} else if (categoryAxis->labelsPosition()
== QCategoryAxis::AxisLabelsPositionOnValue) {
labelOnValue = true;
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos.setY(gridRect.top() + gridRect.bottom()
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 - layout[i + 1] - center.y());
} else {
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 labelPos.setY(upperBound - center.y());
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 }
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 }
Miikka Heikkinen
Fix category axis label positioning....
r2446 }
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
Miikka Heikkinen
Fix label clipping issues using QOpenGLWidget as ChartView viewport...
r2828 // Round to full pixel via QPoint to avoid one pixel clipping on the edge in some cases
labelItem->setPos(labelPos.toPoint());
Miikka Heikkinen
Compensate for rounding errors when determining label visibility...
r2445 //label overlap detection - compensate one pixel for rounding errors
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
if (forceHide)
labelItem->setVisible(false);
} else if (labelItem->pos().y() + boundingRect.height() > height || forceHide ||
Titta Heikkala
Added possibility to set labels position for QCategoryAxis...
r2780 ((labelItem->pos().y() + (heightDiff / 2.0) - 1.0) > axisRect.bottom()
&& !labelOnValue) ||
(labelItem->pos().y() + (heightDiff / 2.0) < (axisRect.top() - 1.0) && !labelOnValue)) {
Michal Klocek
Refactors axis updateGeometry handling...
r2111 labelItem->setVisible(false);
Michal Klocek
Updates axis drawing code...
r2133 }
else {
Michal Klocek
Refactors axis updateGeometry handling...
r2111 labelItem->setVisible(true);
Michal Klocek
Updates axis drawing code...
r2133 height=labelItem->pos().y();
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
//shades
Miikka Heikkinen
Fix shades for log and category axes....
r2721 QGraphicsRectItem *shadeItem = 0;
if (i == 0)
shadeItem = static_cast<QGraphicsRectItem *>(shades.at(0));
else if (i % 2)
shadeItem = static_cast<QGraphicsRectItem *>(shades.at((i / 2) + 1));
if (shadeItem) {
qreal lowerBound;
qreal upperBound;
if (i == 0) {
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 if (axis()->isReverse()) {
Miikka Heikkinen
Fix shades for log and category axes....
r2721 upperBound = gridRect.top();
Titta Heikkala
Add possibility to set reverse values to axes...
r2781 lowerBound = gridRect.top() + gridRect.bottom() - layout[i];
} else {
lowerBound = gridRect.bottom();
upperBound = layout[0];
}
} else {
if (axis()->isReverse()) {
upperBound = gridRect.top() + gridRect.bottom() - layout[i];
if (i == layout.size() - 1) {
lowerBound = gridRect.bottom();
} else {
lowerBound = qMax(gridRect.top() + gridRect.bottom() - layout[i + 1],
gridRect.top());
}
} else {
lowerBound = layout[i];
if (i == layout.size() - 1)
upperBound = gridRect.top();
else
upperBound = qMax(layout[i + 1], gridRect.top());
}
Miikka Heikkinen
Fix shades for log and category axes....
r2721
}
Titta Heikkala
Fix category axis shades and labels...
r2760 if (lowerBound > gridRect.bottom())
lowerBound = gridRect.bottom();
if (upperBound < gridRect.top())
upperBound = gridRect.top();
Miikka Heikkinen
Fix shades for log and category axes....
r2721 shadeItem->setRect(gridRect.left(), upperBound, gridRect.width(),
lowerBound - upperBound);
if (shadeItem->rect().height() <= 0.0)
shadeItem->setVisible(false);
Miikka Heikkinen
Prevent drawing shades off-chart...
r2448 else
Miikka Heikkinen
Fix shades for log and category axes....
r2721 shadeItem->setVisible(true);
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
// check if the grid line and the axis tick should be shown
qreal y = gridItem->line().p1().y();
Michal Klocek
Updates axis drawing code...
r2133 if ((y < gridRect.top() || y > gridRect.bottom()))
{
Michal Klocek
Refactors axis updateGeometry handling...
r2111 gridItem->setVisible(false);
tickItem->setVisible(false);
Michal Klocek
Updates axis drawing code...
r2133 }else{
gridItem->setVisible(true);
tickItem->setVisible(true);
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
Titta Heikkala
Added minor ticks to value axis...
r2795 // add minor ticks
QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
if ((i + 1) != layout.size() && valueAxis) {
int minorTickCount = valueAxis->minorTickCount();
if (minorTickCount != 0) {
qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1);
Miikka Heikkinen
Fix the minor axis grid animation...
r2851 if (axis()->isReverse())
minorTickDistance = -minorTickDistance;
Titta Heikkala
Added minor ticks to value axis...
r2795 for (int j = 0; j < minorTickCount; j++) {
QGraphicsLineItem *minorGridItem =
static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j));
QGraphicsLineItem *minorArrowItem =
static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j));
Miikka Heikkinen
Fix the minor axis grid animation...
r2851 minorGridItem->setLine(gridRect.left(),
gridItem->line().p1().y()
- minorTickDistance * qreal(j + 1),
gridRect.right(),
gridItem->line().p1().y()
- minorTickDistance * qreal(j + 1));
Titta Heikkala
Added minor ticks to value axis...
r2795 if (axis()->alignment() == Qt::AlignLeft) {
minorArrowItem->setLine(gridRect.left() - labelPadding() / 2,
minorGridItem->line().p1().y(),
gridRect.left(),
minorGridItem->line().p1().y());
} else if (axis()->alignment() == Qt::AlignRight){
minorArrowItem->setLine(gridRect.right(),
minorGridItem->line().p1().y(),
gridRect.right() + labelPadding() / 2,
minorGridItem->line().p1().y());
}
// check if the minor grid line and the axis tick should be shown
qreal minorYPos = minorGridItem->line().p1().y();
if (minorYPos < gridRect.top() || minorYPos > gridRect.bottom()) {
minorGridItem->setVisible(false);
minorArrowItem->setVisible(false);
} else {
minorGridItem->setVisible(true);
minorArrowItem->setVisible(true);
}
}
}
}
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
//begin/end grid line in case labels between
Jani Honkonen
src folder: another massive victory for coding style police
r2131 if (intervalAxis()) {
Michal Klocek
Refactors axis updateGeometry handling...
r2111 QGraphicsLineItem *gridLine;
Jani Honkonen
src folder: another massive victory for coding style police
r2131 gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
Michal Klocek
Refactors axis updateGeometry handling...
r2111 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
Michal Klocek
Updates axis drawing code...
r2133 gridLine->setVisible(true);
Miikka Heikkinen
Add Polar chart support...
r2483 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size() + 1));
Michal Klocek
Refactors axis updateGeometry handling...
r2111 gridLine->setLine(gridRect.left(), gridRect.bottom(), gridRect.right(), gridRect.bottom());
Michal Klocek
Updates axis drawing code...
r2133 gridLine->setVisible(true);
Michal Klocek
Refactors axis updateGeometry handling...
r2111 }
}
Michal Klocek
Refactors ChartAxis...
r2138 QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
Q_UNUSED(constraint);
Miikka Heikkinen
Add Polar chart support...
r2483 QSizeF sh(0, 0);
Michal Klocek
Refactors ChartAxis...
r2138
Miikka Heikkinen
Add Polar chart support...
r2483 if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
Michal Klocek
Refactors ChartAxis...
r2138 return sh;
switch (which) {
Miikka Heikkinen
Fix multi-line axis titles....
r2530 case Qt::MinimumSize: {
Titta Heikkala
Qt Charts project file structure change...
r2712 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
QStringLiteral("..."));
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
Michal Klocek
Refactors ChartAxis...
r2138 break;
Miikka Heikkinen
Fix multi-line axis titles....
r2530 }
Michal Klocek
Refactors ChartAxis...
r2138 case Qt::MaximumSize:
Miikka Heikkinen
Fix multi-line axis titles....
r2530 case Qt::PreferredSize: {
Miikka Heikkinen
Added HTML support for various text items...
r2539 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
Miikka Heikkinen
Fix multiline axis titles truncation...
r2540 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
Michal Klocek
Refactors ChartAxis...
r2138 break;
Miikka Heikkinen
Fix multi-line axis titles....
r2530 }
Michal Klocek
Refactors ChartAxis...
r2138 default:
break;
}
return sh;
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE