##// END OF EJS Templates
Adds font handling for chart's titile...
Michal Klocek -
r192:5238f1b4589b
parent child
Show More
@@ -35,7 +35,7 int main(int argc, char *argv[])
35 35 QChartView* chartView = new QChartView(&window);
36 36
37 37 chartView->setRenderHint(QPainter::Antialiasing);
38 chartView->setTitle("Basic line chart example");
38 chartView->setChartTitle("This is custom axis chart example");
39 39 chartView->addSeries(series0);
40 40 chartView->addSeries(series1);
41 41
@@ -33,7 +33,11 int main(int argc, char *argv[])
33 33
34 34 QChartView* chartView = new QChartView(&window);
35 35 chartView->setRenderHint(QPainter::Antialiasing);
36 chartView->setTitle("Custom color line chart example");
36
37 QFont font;
38 font.setPixelSize(18);
39 chartView->setChartTitleFont(font);
40 chartView->setChartTitle("Custom color line chart example");
37 41 chartView->addSeries(series0);
38 42 chartView->addSeries(series1);
39 43
@@ -28,7 +28,7 int main(int argc, char *argv[])
28 28
29 29 chartView->setViewport( new QGLWidget() );
30 30 chartView->setRenderHint(QPainter::Antialiasing);
31 chartView->setTitle("This is wave generator buahha.");
31 chartView->setChartTitle("This is wave generator buahha.");
32 32 chartView->addSeries(series0);
33 33 chartView->addSeries(series1);
34 34
@@ -34,7 +34,7 int main(int argc, char *argv[])
34 34 QChartView* chartView = new QChartView(&window);
35 35
36 36 chartView->setRenderHint(QPainter::Antialiasing);
37 chartView->setTitle("Basic line chart example");
37 chartView->setChartTitle("Basic line chart example");
38 38 chartView->addSeries(series0);
39 39 chartView->addSeries(series1);
40 40
@@ -32,7 +32,7 int main(int argc, char *argv[])
32 32
33 33 ChartWidget* chartWidget = new ChartWidget(&window);
34 34 chartWidget->setRenderHint(QPainter::Antialiasing);
35 chartWidget->setTitle("Zoom in/out line chart example");
35 chartWidget->setChartTitle("Zoom in/out line chart example");
36 36 chartWidget->addSeries(series0);
37 37 chartWidget->addSeries(series1);
38 38
@@ -96,10 +96,15 void QChart::setChartBackgroundPen(const QPen& pen)
96 96 m_backgroundItem->update();
97 97 }
98 98
99 void QChart::setTitle(const QString& title,const QFont& font)
99 void QChart::setChartTitle(const QString& title)
100 100 {
101 101 if(!m_titleItem) m_titleItem = new QGraphicsTextItem(this);
102 102 m_titleItem->setPlainText(title);
103 }
104
105 void QChart::setChartTitleFont(const QFont& font)
106 {
107 if(!m_titleItem) m_titleItem = new QGraphicsTextItem(this);
103 108 m_titleItem->setFont(font);
104 109 }
105 110
@@ -58,7 +58,8 public:
58 58 void setChartTheme(QChart::ChartTheme theme);
59 59 QChart::ChartTheme chartTheme() const;
60 60
61 void setTitle(const QString& title,const QFont& font = QFont());
61 void setChartTitle(const QString& title);
62 void setChartTitleFont(const QFont& font);
62 63 void setChartBackgroundBrush(const QBrush& brush);
63 64 void setChartBackgroundPen(const QPen& pen);
64 65
@@ -67,9 +67,14 int QChartView::margin() const
67 67 return m_chart->margin();
68 68 }
69 69
70 void QChartView::setTitle(const QString& title)
70 void QChartView::setChartTitle(const QString& title)
71 71 {
72 m_chart->setTitle(title);
72 m_chart->setChartTitle(title);
73 }
74
75 void QChartView::setChartTitleFont(const QFont& font)
76 {
77 m_chart->setChartTitleFont(font);
73 78 }
74 79
75 80 void QChartView::setChartBackgroundBrush(const QBrush& brush)
@@ -31,7 +31,8 public:
31 31
32 32 int margin() const;
33 33
34 void setTitle(const QString& title);
34 void setChartTitle(const QString& title);
35 void setChartTitleFont(const QFont& font);
35 36 void setChartBackgroundBrush(const QBrush& brush);
36 37 void setChartBackgroundPen(const QPen& pen);
37 38
General Comments 0
You need to be logged in to leave comments. Login now