##// END OF EJS Templates
Fixed regression in declarative impl
Tero Ahola -
r168:23b5a494bf5a
parent child
Show More
@@ -1,27 +1,27
1 #include "declarativechart.h"
1 #include "declarativechart.h"
2
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
5 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
6 : QDeclarativeItem(parent),
6 : QDeclarativeItem(parent),
7 m_chart(new QChart(this))
7 m_chart(new QChart(this))
8 {
8 {
9 setFlag(QGraphicsItem::ItemHasNoContents, false);
9 setFlag(QGraphicsItem::ItemHasNoContents, false);
10 m_chart->resize(QSize(height(), width()));
10 // m_chart->setMargin(50); // TODO: should not be needed?
11 m_chart->setMargin(25); // TODO: should not be needed?
12 }
11 }
13
12
14 DeclarativeChart::ChartTheme DeclarativeChart::theme()
13 DeclarativeChart::ChartTheme DeclarativeChart::theme()
15 {
14 {
16 if (m_chart)
15 if (m_chart)
17 return (ChartTheme) m_chart->chartTheme();
16 return (ChartTheme) m_chart->chartTheme();
18 }
17 }
19
18
20 void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
19 void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
21 {
20 {
22 m_chart->resize(QSize(newGeometry.width(), newGeometry.height()));
21 if (newGeometry.isValid())
22 m_chart->resize(newGeometry.width(), newGeometry.height());
23 }
23 }
24
24
25 #include "moc_declarativechart.cpp"
25 #include "moc_declarativechart.cpp"
26
26
27 QTCOMMERCIALCHART_END_NAMESPACE
27 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,46 +1,46
1 import QtQuick 1.0
1 import QtQuick 1.0
2 import QtCommercial.Chart 1.0
2 import QtCommercial.Chart 1.0
3
3
4 Rectangle {
4 Rectangle {
5 width: 360
5 width: 360
6 height: 360
6 height: 360
7 Text {
7 Text {
8 text: qsTr("Hello World")
8 text: qsTr("Hello World")
9 anchors.centerIn: parent
9 anchors.centerIn: parent
10 }
10 }
11
11
12 Chart {
12 Chart {
13 anchors.fill: parent
13 anchors.fill: parent
14 theme: Chart.ThemeIcy
14 theme: Chart.ThemeIcy
15
15
16 // PieSeries {
16 // PieSeries {
17 // labels: ["point1", "point2", "point3", "point4", "point5"]
17 // labels: ["point1", "point2", "point3", "point4", "point5"]
18 // datax: [2, 1.5, 3, 3, 3]
18 // datax: [2, 1.5, 3, 3, 3]
19 // }
19 // }
20 PieSeries {
20 // PieSeries {
21 name: "raspberry pie"
21 // name: "raspberry pie"
22 seriesLabels: ["point1", "point2", "point3", "point4", "point5"]
22 // seriesLabels: ["point1", "point2", "point3", "point4", "point5"]
23 seriesData: [2, 1.5, 3, 3, 3]
23 // seriesData: [2, 1.5, 3, 3, 3]
24 }
24 // }
25 ScatterSeries {
25 // ScatterSeries {
26 name: "scatter1"
26 // name: "scatter1"
27 datax: [2, 1.5, 3, 3, 3]
27 // datax: [2, 1.5, 3, 3, 3]
28 datay: [2, 1.5, 3, 3, 3]
28 // datay: [2, 1.5, 3, 3, 3]
29 }
29 // }
30 // Series {
30 // Series {
31 // labels: ["point1", "point2", "point3", "point4", "point5"]
31 // labels: ["point1", "point2", "point3", "point4", "point5"]
32 // datax: [2, 1.5, 3, 3, 3]
32 // datax: [2, 1.5, 3, 3, 3]
33 // seriesType: Series.SeriesTypePie
33 // seriesType: Series.SeriesTypePie
34 // }
34 // }
35 Series {
35 Series {
36 seriesType: Series.SeriesTypeScatter
36 seriesType: Series.SeriesTypeScatter
37 }
37 }
38 Series {
38 Series {
39 seriesType: Series.SeriesTypeLine
39 seriesType: Series.SeriesTypeLine
40 }
40 }
41 // TODO:
41 // TODO:
42 // Series {
42 // Series {
43 // seriesType: Series.SeriesTypeBar
43 // seriesType: Series.SeriesTypeBar
44 // }
44 // }
45 }
45 }
46 }
46 }
General Comments 0
You need to be logged in to leave comments. Login now