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