##// END OF EJS Templates
QML api to use chart theme enum of QChart
Tero Ahola -
r836:6601c1904416
parent child
Show More
@@ -35,9 +35,9 DeclarativeChart::~DeclarativeChart()
35 35 delete m_chart;
36 36 }
37 37
38 DeclarativeChart::ChartTheme DeclarativeChart::theme()
38 QChart::ChartTheme DeclarativeChart::theme()
39 39 {
40 return (ChartTheme) m_chart->theme();
40 return m_chart->theme();
41 41 }
42 42
43 43 void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -32,20 +32,9 class DeclarativeChart : public QDeclarativeItem
32 32 //class DeclarativeChart : public QQuickPaintedItem, public Chart
33 33 {
34 34 Q_OBJECT
35 Q_ENUMS(ChartTheme)
36 Q_PROPERTY(ChartTheme theme READ theme WRITE setTheme)
35 Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
37 36
38 37 public:
39 enum ChartTheme {
40 ThemeDefault,
41 ThemeLight,
42 ThemeBlueCerulean,
43 ThemeDark,
44 ThemeBrownSand,
45 ThemeBlueNcs,
46 ThemeHighContrast,
47 ThemeBlueIcy
48 };
49 38 DeclarativeChart(QDeclarativeItem *parent = 0);
50 39 ~DeclarativeChart();
51 40
@@ -54,8 +43,8 public: // From QDeclarativeItem/QGraphicsItem
54 43 void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
55 44
56 45 public:
57 void setTheme(ChartTheme theme) {m_chart->setTheme((QChart::ChartTheme) theme);}
58 ChartTheme theme();
46 void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);}
47 QChart::ChartTheme theme();
59 48
60 49 public:
61 50 // Extending QChart with DeclarativeChart is not possible because QObject does not support
@@ -20,6 +20,7
20 20
21 21 #include <QtDeclarative/qdeclarativeextensionplugin.h>
22 22 #include <QtDeclarative/qdeclarative.h>
23 #include "qchart.h"
23 24 #include "declarativechart.h"
24 25 #include "declarativexypoint.h"
25 26 #include "declarativelineseries.h"
@@ -36,6 +36,8 struct QChartPrivate;
36 36 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
37 37 {
38 38 Q_OBJECT
39 Q_ENUMS(ChartTheme)
40
39 41 public:
40 42 enum ChartTheme {
41 43 ChartThemeDefault,
@@ -54,7 +54,7 Rectangle {
54 54 anchors.left: parent.left
55 55 anchors.right: parent.right
56 56 height: parent.height / 2
57 theme: Chart.ThemeBlueCerulean
57 theme: Chart.ChartThemeBlueCerulean
58 58
59 59 BarSeries {
60 60 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
@@ -79,7 +79,7 Rectangle {
79 79 anchors.bottom: parent.bottom
80 80 anchors.left: parent.left
81 81 anchors.right: parent.right
82 theme: Chart.ThemeBrownSand
82 theme: Chart.ChartThemeHighContrast
83 83
84 84 LineSeries {
85 85 points: [
General Comments 0
You need to be logged in to leave comments. Login now