0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-03 20:04:43 +03:00

Add fonts to charts

This commit is contained in:
Emil Sawicki
2022-01-31 16:43:47 +01:00
parent da9c422f74
commit 981c90edfd
2 changed files with 70 additions and 11 deletions

View File

@@ -78,9 +78,15 @@ public:
virtual void paintChartLegend(QPainter *painter, QRectF legendRect) =0;
virtual QSizeF calcChartLegendSize(const QFont &font) = 0;
virtual QRectF calcChartLegendRect(const QFont& font, const QRectF& parentRect, bool takeAllRect, qreal borderMargin, qreal titleOffset);
QFont titleFont();
void setTitleFont(const QFont &value);
protected:
virtual void prepareLegendToPaint(QRectF& legendRect, QPainter *painter);
protected:
// Title font must be placed here instead of CharItem, becuase
// it would cause crash when creating CharItem object on embedded
QFont m_titleFont;
ChartItem* m_chartItem;
QList<QString> m_designLabels;
};
@@ -139,6 +145,8 @@ class ChartItem : public LimeReport::ItemDesignIntf
Q_PROPERTY(ChartType chartType READ chartType WRITE setChartType)
Q_PROPERTY(QString labelsField READ labelsField WRITE setLabelsField)
Q_PROPERTY(bool showLegend READ showLegend WRITE setShowLegend)
Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont)
Q_PROPERTY(QFont font READ font WRITE setCharItemFont)
//linesChart
Q_PROPERTY(bool drawPoints READ drawPoints WRITE setDrawPoints)
@@ -226,6 +234,10 @@ public:
GridChartLines gridChartLines() const;
void setGridChartLines(GridChartLines flags);
QFont titleFont() const;
void setTitleFont(QFont value);
void setCharItemFont(QFont value);
protected:
void paintChartTitle(QPainter* painter, QRectF titleRect);
virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);