##// END OF EJS Templates
Fix text color for debug information...
Titta Heikkala -
r2615:43b255a1880d
parent child
Show More
@@ -1,95 +1,95
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "chartbackground_p.h"
21 #include "chartbackground_p.h"
22 #include "chartconfig_p.h"
22 #include "chartconfig_p.h"
23 #include <QPen>
23 #include <QPen>
24 #include <QBrush>
24 #include <QBrush>
25 #include <QPainter>
25 #include <QPainter>
26 #include <QGraphicsDropShadowEffect>
26 #include <QGraphicsDropShadowEffect>
27
27
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
29
30 ChartBackground::ChartBackground(QGraphicsItem *parent)
30 ChartBackground::ChartBackground(QGraphicsItem *parent)
31 : QGraphicsRectItem(parent),
31 : QGraphicsRectItem(parent),
32 m_diameter(5),
32 m_diameter(5),
33 m_dropShadow(0)
33 m_dropShadow(0)
34 {
34 {
35 }
35 }
36
36
37 ChartBackground::~ChartBackground()
37 ChartBackground::~ChartBackground()
38 {
38 {
39
39
40 }
40 }
41
41
42 void ChartBackground::setDropShadowEnabled(bool enabled)
42 void ChartBackground::setDropShadowEnabled(bool enabled)
43 {
43 {
44 if (enabled) {
44 if (enabled) {
45 if (!m_dropShadow) {
45 if (!m_dropShadow) {
46 m_dropShadow = new QGraphicsDropShadowEffect();
46 m_dropShadow = new QGraphicsDropShadowEffect();
47 #ifdef Q_OS_MAC
47 #ifdef Q_OS_MAC
48 m_dropShadow->setBlurRadius(15);
48 m_dropShadow->setBlurRadius(15);
49 m_dropShadow->setOffset(0, 0);
49 m_dropShadow->setOffset(0, 0);
50 #elif defined(Q_OS_WIN)
50 #elif defined(Q_OS_WIN)
51 m_dropShadow->setBlurRadius(10);
51 m_dropShadow->setBlurRadius(10);
52 m_dropShadow->setOffset(0, 0);
52 m_dropShadow->setOffset(0, 0);
53 #else
53 #else
54 m_dropShadow->setBlurRadius(10);
54 m_dropShadow->setBlurRadius(10);
55 m_dropShadow->setOffset(5, 5);
55 m_dropShadow->setOffset(5, 5);
56 #endif
56 #endif
57 setGraphicsEffect(m_dropShadow);
57 setGraphicsEffect(m_dropShadow);
58 }
58 }
59 } else {
59 } else {
60 delete m_dropShadow;
60 delete m_dropShadow;
61 m_dropShadow = 0;
61 m_dropShadow = 0;
62 }
62 }
63 }
63 }
64
64
65 void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
65 void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
66 {
66 {
67 Q_UNUSED(option);
67 Q_UNUSED(option);
68 Q_UNUSED(widget);
68 Q_UNUSED(widget);
69 painter->save();
69 painter->save();
70 painter->setPen(pen());
70 painter->setPen(pen());
71 painter->setBrush(brush());
71 painter->setBrush(brush());
72 painter->drawRoundedRect(rect(), m_diameter, m_diameter);
72 painter->drawRoundedRect(rect(), m_diameter, m_diameter);
73 #ifndef QT_NO_DEBUG
73 #ifndef QT_NO_DEBUG
74 painter->setPen(Qt::black);
74 painter->setPen(Qt::gray);
75 QFont font;
75 QFont font;
76 QString build("build %1");
76 QString build("build %1");
77 font.setPointSize(6);
77 font.setPointSize(6);
78 painter->setFont(font);
78 painter->setFont(font);
79 painter->drawText(rect().bottomLeft(), build.arg(ChartConfig::instance()->compilationTime()));
79 painter->drawText(rect().bottomLeft(), build.arg(ChartConfig::instance()->compilationTime()));
80 #endif
80 #endif
81 painter->restore();
81 painter->restore();
82 }
82 }
83
83
84 qreal ChartBackground::diameter() const
84 qreal ChartBackground::diameter() const
85 {
85 {
86 return m_diameter;
86 return m_diameter;
87 }
87 }
88
88
89 void ChartBackground::setDiameter(qreal diameter)
89 void ChartBackground::setDiameter(qreal diameter)
90 {
90 {
91 m_diameter = diameter;
91 m_diameter = diameter;
92 update();
92 update();
93 }
93 }
94
94
95 QTCOMMERCIALCHART_END_NAMESPACE
95 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now