@@ -1,40 +1,40 | |||||
1 | #include "declarativechart.h" |
|
1 | #include "declarativechart.h" | |
2 |
#include <QPainter> |
|
2 | #include <QPainter> | |
3 |
|
3 | |||
4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
5 |
|
5 | |||
6 | DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) |
|
6 | DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) | |
7 | : QDeclarativeItem(parent), |
|
7 | : QDeclarativeItem(parent), | |
8 | m_chart(new QChart(this)) |
|
8 | m_chart(new QChart(this)) | |
9 | { |
|
9 | { | |
10 | setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
10 | setFlag(QGraphicsItem::ItemHasNoContents, false); | |
11 | } |
|
11 | } | |
12 |
|
12 | |||
13 | DeclarativeChart::ChartTheme DeclarativeChart::theme() |
|
13 | DeclarativeChart::ChartTheme DeclarativeChart::theme() | |
14 | { |
|
14 | { | |
15 | return (ChartTheme) m_chart->chartTheme(); |
|
15 | return (ChartTheme) m_chart->chartTheme(); | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
18 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | |
19 | { |
|
19 | { | |
20 | Q_UNUSED(oldGeometry) |
|
20 | Q_UNUSED(oldGeometry) | |
21 |
|
21 | |||
22 | if (newGeometry.isValid()) { |
|
22 | if (newGeometry.isValid()) { | |
23 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { |
|
23 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { | |
24 | m_chart->resize(newGeometry.width(), newGeometry.height()); |
|
24 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
25 | } |
|
25 | } | |
26 | } |
|
26 | } | |
27 | } |
|
27 | } | |
28 |
|
28 | |||
29 | void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
29 | void DeclarativeChart::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
30 | { |
|
30 | { | |
31 | Q_UNUSED(option) |
|
31 | Q_UNUSED(option) | |
32 | Q_UNUSED(widget) |
|
32 | Q_UNUSED(widget) | |
33 |
|
33 | |||
34 | // TODO: optimized? |
|
34 | // TODO: optimized? | |
35 | painter->setRenderHint(QPainter::Antialiasing, true); |
|
35 | painter->setRenderHint(QPainter::Antialiasing, true); | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | #include "moc_declarativechart.cpp" |
|
38 | #include "moc_declarativechart.cpp" | |
39 |
|
39 | |||
40 | QTCOMMERCIALCHART_END_NAMESPACE |
|
40 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now