##// END OF EJS Templates
Add build stamp and git head support for debug
Michal Klocek -
r715:f8597835a464
parent child
Show More
@@ -1,4 +1,5
1 #include "chartbackground_p.h"
1 #include "chartbackground_p.h"
2 #include "qchartversion_p.h"
2 #include <QPen>
3 #include <QPen>
3 #include <QBrush>
4 #include <QBrush>
4 #include <QPainter>
5 #include <QPainter>
@@ -8,7 +9,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent),
9 ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent),
9 m_diameter(15)
10 m_diameter(15)
10 {
11 {
11
12 #ifndef QT_NO_DEBUG
13 qDebug()<<"buildTime" <<buildTime;
14 qDebug()<<"gitHead" << gitHead;
15 #endif
12 }
16 }
13
17
14 ChartBackground::~ChartBackground()
18 ChartBackground::~ChartBackground()
@@ -20,9 +24,19 void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
20 {
24 {
21 Q_UNUSED(option);
25 Q_UNUSED(option);
22 Q_UNUSED(widget);
26 Q_UNUSED(widget);
27 painter->save();
23 painter->setPen(pen());
28 painter->setPen(pen());
24 painter->setBrush(brush());
29 painter->setBrush(brush());
25 painter->drawRoundRect(rect(),roundness(rect().width()),roundness(rect().height()));
30 painter->drawRoundRect(rect(),roundness(rect().width()),roundness(rect().height()));
31 #ifndef QT_NO_DEBUG
32 painter->setPen(Qt::black);
33 QFont font;
34 QString build("build %1");
35 font.setPointSize(6);
36 painter->setFont(font);
37 painter->drawText(rect().bottomLeft(),build.arg(buildTime));
38 #endif
39 painter->restore();
26 }
40 }
27
41
28 int ChartBackground::roundness(qreal size) const
42 int ChartBackground::roundness(qreal size) const
@@ -6,7 +6,6
6 #include "chartbackground_p.h"
6 #include "chartbackground_p.h"
7 #include <QGraphicsScene>
7 #include <QGraphicsScene>
8 #include <QGraphicsSceneResizeEvent>
8 #include <QGraphicsSceneResizeEvent>
9 #include <QDebug>
10
9
11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12
11
@@ -121,11 +121,21 install_build_private_headers.CONFIG += target_predeps \
121 QMAKE_EXTRA_COMPILERS += install_build_public_headers \
121 QMAKE_EXTRA_COMPILERS += install_build_public_headers \
122 install_build_private_headers \
122 install_build_private_headers \
123
123
124
124 chartversion.target = qchartversion_p.h
125 chartversion.target = qchartversion_p.h
126 unix:{
125 chartversion.commands = @echo \
127 chartversion.commands = @echo \
126 "build_time" \
128 "const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" \\; \
129 const char *gitHead = \\\"`git rev-parse HEAD`\\\" \\; " \
127 > \
130 > \
128 $$chartversion.target;
131 $$chartversion.target;
132 }else{
133 chartversion.commands = @echo \
134 "const char *buildTime = \"%date%_%time%\" ; \
135 const char *gitHead = \"unknown\" ; " \
136 > \
137 $$chartversion.target
138 }
129 chartversion.depends = $$HEADERS \
139 chartversion.depends = $$HEADERS \
130 $$SOURCES
140 $$SOURCES
131 PRE_TARGETDEPS += qchartversion_p.h
141 PRE_TARGETDEPS += qchartversion_p.h
General Comments 0
You need to be logged in to leave comments. Login now