##// END OF EJS Templates
Default theme with OS specific colors on Windows
Tero Ahola -
r537:f223805ee598
parent child
Show More
@@ -1,4 +1,8
1 1 #include "charttheme_p.h"
2 #ifdef Q_OS_WIN
3 #include <windows.h>
4 #include <stdio.h>
5 #endif
2 6
3 7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 8
@@ -7,10 +11,77 class ChartThemeDefault: public ChartTheme
7 11 public:
8 12 ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault)
9 13 {
10 // TODO: replace this dummy theme with an actual theme
14 #ifdef Q_OS_WIN
15 // First series base color from COLOR_WINDOWFRAME
16 DWORD colorWindowFrame;
17 colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
18 m_seriesColors.append(QColor(GetRValue(colorWindowFrame), GetGValue(colorWindowFrame),GetBValue(colorWindowFrame)));
19
20 // Second series base color from COLOR_HIGHLIGHT
21 DWORD colorHighlight;
22 colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
23 m_seriesColors.append(QColor(GetRValue(colorHighlight), GetGValue(colorHighlight),GetBValue(colorHighlight)));
24
25 // Thirs series base color from the middle of the COLOR_ACTIVECAPTION /
26 // COLOR_GRADIENTACTIVECAPTION gradient
27 DWORD colorGradientActiveCaptionLeft;
28 colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
29 DWORD colorGradientActiveCaptionRight;
30 colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
31 QLinearGradient g;
32 QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
33 GetGValue(colorGradientActiveCaptionLeft),
34 GetBValue(colorGradientActiveCaptionLeft));
35 g.setColorAt(0.0, start);
36 QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
37 GetGValue(colorGradientActiveCaptionRight),
38 GetBValue(colorGradientActiveCaptionRight));
39 g.setColorAt(1.0, end);
40 m_seriesColors.append(colorAt(g, 0.5));
41
42 // Generate gradients from the base colors
43 generateSeriesGradients();
44
45 // Background fill color from COLOR_WINDOW
46 QLinearGradient backgroundGradient;
47 DWORD colorWindow;
48 colorWindow = GetSysColor(COLOR_WINDOW);
49 backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
50 GetGValue(colorWindow),
51 GetBValue(colorWindow)));
52 backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
53 GetGValue(colorWindow),
54 GetBValue(colorWindow)));
55
56 // TODO: COLOR_WINDOWTEXT for text color?
57 // TODO: COLOR_INFOTEXT for tooltip text color?
58 // TODO: COLOR_INFOBK for tooltip background color?
59 #elif Q_OS_LINUX
60 // TODO: replace this dummy theme with linux specific theme
61 m_seriesColors << QRgb(0xff707070);
62 m_seriesColors << QRgb(0xffA0A0A0);
63 generateSeriesGradients();
64
65 QLinearGradient backgroundGradient;
66 backgroundGradient.setColorAt(0.0, QRgb(0xffffffff));
67 backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf));
68 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
69 m_backgroundGradient = backgroundGradient;
70 #elif Q_OS_MAC
71 // TODO: replace this dummy theme with OSX specific theme
11 72 m_seriesColors << QRgb(0xff707070);
12 73 m_seriesColors << QRgb(0xffA0A0A0);
74 generateSeriesGradients();
13 75
76 QLinearGradient backgroundGradient;
77 backgroundGradient.setColorAt(0.0, QRgb(0xffffffff));
78 backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf));
79 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
80 m_backgroundGradient = backgroundGradient;
81 #else
82 // TODO: replace this dummy theme with generic (not OS specific) theme
83 m_seriesColors << QRgb(0xff707070);
84 m_seriesColors << QRgb(0xffA0A0A0);
14 85 generateSeriesGradients();
15 86
16 87 QLinearGradient backgroundGradient;
@@ -18,6 +89,7 public:
18 89 backgroundGradient.setColorAt(1.0, QRgb(0xffafafaf));
19 90 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
20 91 m_backgroundGradient = backgroundGradient;
92 #endif
21 93 }
22 94 };
23 95
General Comments 0
You need to be logged in to leave comments. Login now