0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-31 21:31:21 +03:00

Qt6 support added

This commit is contained in:
fralx
2021-01-20 14:47:05 +03:00
parent e3356a3d00
commit 81f27782be
39 changed files with 759 additions and 204 deletions

View File

@@ -36,7 +36,11 @@ void HorizontalBarChart::paintHorizontalBars(QPainter *painter, QRectF barsRect)
delta = genNextValue(delta);
qreal vStep = (barsRect.height()-painter->fontMetrics().height()) / valuesCount() / seriesCount();
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
qreal hStep = (barsRect.width()-painter->fontMetrics().horizontalAdvance(QString::number(maxValue()))) / delta;
#else
qreal hStep = (barsRect.width()-painter->fontMetrics().width(QString::number(maxValue()))) / delta;
#endif
if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){
int curSeries = 0;

View File

@@ -14,7 +14,13 @@ void PieChart::drawPercent(QPainter *painter, QRectF chartRect, qreal startAngle
#ifdef HAVE_QT5
qreal radAngle = qDegreesToRadians(angle/2+startAngle);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
qreal radius = painter->fontMetrics().horizontalAdvance("99,9%");
#else
qreal radius = painter->fontMetrics().width("99,9%");
#endif
qreal border = chartRect.height()*0.02;
qreal length = (chartRect.height())/2-(radius/2+border);
qreal x,y;
@@ -155,14 +161,24 @@ QSizeF PieChart::calcChartLegendSize(const QFont &font)
SeriesItem* si = m_chartItem->series().at(0);
foreach(QString label, si->data()->labels()){
cw += fm.height();
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
if (maxWidth<fm.horizontalAdvance(label))
maxWidth = fm.horizontalAdvance(label)+10;
#else
if (maxWidth<fm.width(label))
maxWidth = fm.width(label)+10;
#endif
}
} else {
foreach(QString label, m_designLabels){
cw += fm.height();
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
if (maxWidth<fm.horizontalAdvance(label))
maxWidth = fm.horizontalAdvance(label)+10;
#else
if (maxWidth<fm.width(label))
maxWidth = fm.width(label)+10;
#endif
}
}
cw += fm.height();