##// END OF EJS Templates
Adds ChartConfig class
Michal Klocek -
r719:05b8360d3351
parent child
Show More
@@ -0,0 +1,45
1 #ifndef CHARTCONFIG_H_
2 #define CHARTCONFIG_H_
3
4 #include "qchartglobal.h"
5 #include "qchartversion_p.h"
6
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
10 class ChartConfig {
11
12 private:
13 ChartConfig(){
14 #ifndef QT_NO_DEBUG
15 qDebug()<<"buildTime" << buildTime;
16 qDebug()<<"gitHead" << gitHead;
17 #endif
18 m_instance = this;
19 }
20 public:
21 static ChartConfig* instance(){
22 if(!m_instance){
23 m_instance= new ChartConfig();
24 }
25 return m_instance;
26 }
27
28 QString compilationTime(){
29 return buildTime;
30 }
31
32 QString compilationHead(){
33 return gitHead;
34 }
35
36 private:
37 static ChartConfig* m_instance;
38 };
39
40
41 ChartConfig* ChartConfig::m_instance=0;
42
43 #endif
44
45 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,5 +1,5
1 #include "chartbackground_p.h"
1 #include "chartbackground_p.h"
2 #include "qchartversion_p.h"
2 #include "chartconfig_p.h"
3 #include <QPen>
3 #include <QPen>
4 #include <QBrush>
4 #include <QBrush>
5 #include <QPainter>
5 #include <QPainter>
@@ -9,10 +9,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent),
9 ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent),
10 m_diameter(15)
10 m_diameter(15)
11 {
11 {
12 #ifndef QT_NO_DEBUG
13 qDebug()<<"buildTime" <<buildTime;
14 qDebug()<<"gitHead" << gitHead;
15 #endif
16 }
12 }
17
13
18 ChartBackground::~ChartBackground()
14 ChartBackground::~ChartBackground()
@@ -34,7 +30,7 void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
34 QString build("build %1");
30 QString build("build %1");
35 font.setPointSize(6);
31 font.setPointSize(6);
36 painter->setFont(font);
32 painter->setFont(font);
37 painter->drawText(rect().bottomLeft(),build.arg(buildTime));
33 painter->drawText(rect().bottomLeft(),build.arg(ChartConfig::instance()->compilationTime()));
38 #endif
34 #endif
39 painter->restore();
35 painter->restore();
40 }
36 }
@@ -29,7 +29,8 PRIVATE_HEADERS += \
29 $$PWD/legendmarker_p.h \
29 $$PWD/legendmarker_p.h \
30 $$PWD/legendscrollbutton_p.h \
30 $$PWD/legendscrollbutton_p.h \
31 $$PWD/chartbackground_p.h \
31 $$PWD/chartbackground_p.h \
32 $$PWD/chart_p.h
32 $$PWD/chart_p.h \
33 $$PWD/chartconfig_p.h
33 PUBLIC_HEADERS += \
34 PUBLIC_HEADERS += \
34 $$PWD/qchart.h \
35 $$PWD/qchart.h \
35 $$PWD/qchartglobal.h \
36 $$PWD/qchartglobal.h \
General Comments 0
You need to be logged in to leave comments. Login now