@@ -1,39 +1,38 | |||||
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 | } |
|
10 | } | |
11 |
|
11 | |||
12 | DeclarativeChart::ChartTheme DeclarativeChart::theme() |
|
12 | DeclarativeChart::ChartTheme DeclarativeChart::theme() | |
13 | { |
|
13 | { | |
14 | if (m_chart) |
|
|||
15 |
|
|
14 | return (ChartTheme) m_chart->chartTheme(); | |
16 | } |
|
15 | } | |
17 |
|
16 | |||
18 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
17 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | |
19 | { |
|
18 | { | |
20 | qDebug() << "geometryChanged " << this << " old geometry: " << oldGeometry; |
|
19 | qDebug() << "geometryChanged " << this << " old geometry: " << oldGeometry; | |
21 | if (newGeometry.isValid()) { |
|
20 | if (newGeometry.isValid()) { | |
22 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { |
|
21 | if (newGeometry.width() > 0 && newGeometry.height() > 0) { | |
23 | // TODO: setting margin should not be needed to make axis visible? |
|
22 | // TODO: setting margin should not be needed to make axis visible? | |
24 | const int margin = 30; |
|
23 | const int margin = 30; | |
25 | if (m_chart->margin() == 0 |
|
24 | if (m_chart->margin() == 0 | |
26 | && newGeometry.width() > (margin * 2) |
|
25 | && newGeometry.width() > (margin * 2) | |
27 | && newGeometry.height() > (margin * 2)) { |
|
26 | && newGeometry.height() > (margin * 2)) { | |
28 | m_chart->setMargin(margin); |
|
27 | m_chart->setMargin(margin); | |
29 | m_chart->resize(newGeometry.width(), newGeometry.height()); |
|
28 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
30 | } else { |
|
29 | } else { | |
31 | m_chart->resize(newGeometry.width(), newGeometry.height()); |
|
30 | m_chart->resize(newGeometry.width(), newGeometry.height()); | |
32 | } |
|
31 | } | |
33 | } |
|
32 | } | |
34 | } |
|
33 | } | |
35 | } |
|
34 | } | |
36 |
|
35 | |||
37 | #include "moc_declarativechart.cpp" |
|
36 | #include "moc_declarativechart.cpp" | |
38 |
|
37 | |||
39 | QTCOMMERCIALCHART_END_NAMESPACE |
|
38 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,37 +1,35 | |||||
1 | #include <QtDeclarative/qdeclarativeextensionplugin.h> |
|
1 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | |
2 | #include <QtDeclarative/qdeclarative.h> |
|
2 | #include <QtDeclarative/qdeclarative.h> | |
3 | #include "declarativechart.h" |
|
3 | #include "declarativechart.h" | |
4 | #include "declarativeseries.h" |
|
|||
5 | #include "scatterelement.h" |
|
4 | #include "scatterelement.h" | |
6 | #include "declarativescatterseries.h" |
|
5 | #include "declarativescatterseries.h" | |
7 | #include "declarativelineseries.h" |
|
6 | #include "declarativelineseries.h" | |
8 | #include "declarativepieseries.h" |
|
7 | #include "declarativepieseries.h" | |
9 |
|
8 | |||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
10 | |||
12 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
11 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin | |
13 | { |
|
12 | { | |
14 | Q_OBJECT |
|
13 | Q_OBJECT | |
15 | public: |
|
14 | public: | |
16 | virtual void registerTypes(const char *uri) |
|
15 | virtual void registerTypes(const char *uri) | |
17 | { |
|
16 | { | |
18 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
17 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); | |
19 |
|
18 | |||
20 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "Chart"); |
|
19 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "Chart"); | |
21 | qmlRegisterType<DeclarativeSeries>(uri, 1, 0, "Series"); |
|
|||
22 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
20 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); | |
23 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
21 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); | |
24 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
22 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); | |
25 | qmlRegisterType<QPieSlice>(uri, 1, 0, "ChartPieElement"); |
|
23 | qmlRegisterType<QPieSlice>(uri, 1, 0, "ChartPieElement"); | |
26 | // TODO: rename ScatterElement class to something like "PointElement" |
|
24 | // TODO: rename ScatterElement class to something like "PointElement" | |
27 | qmlRegisterType<ScatterElement>(uri, 1, 0, "ChartPointElement"); |
|
25 | qmlRegisterType<ScatterElement>(uri, 1, 0, "ChartPointElement"); | |
28 | } |
|
26 | } | |
29 | }; |
|
27 | }; | |
30 |
|
28 | |||
31 | #include "plugin.moc" |
|
29 | #include "plugin.moc" | |
32 |
|
30 | |||
33 | QTCOMMERCIALCHART_END_NAMESPACE |
|
31 | QTCOMMERCIALCHART_END_NAMESPACE | |
34 |
|
32 | |||
35 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
33 | QTCOMMERCIALCHART_USE_NAMESPACE | |
36 |
|
34 | |||
37 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
|
35 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
@@ -1,67 +1,45 | |||||
1 | !include( ../common.pri ) { |
|
1 | !include( ../common.pri ) { | |
2 | error( "Couldn't find the common.pri file!" ) |
|
2 | error( "Couldn't find the common.pri file!" ) | |
3 | } |
|
3 | } | |
4 | !include( ../integrated.pri ) { |
|
4 | !include( ../integrated.pri ) { | |
5 | error( "Couldn't find the integrated.pri file !") |
|
5 | error( "Couldn't find the integrated.pri file !") | |
6 | } |
|
6 | } | |
7 |
|
7 | |||
8 | TEMPLATE = lib |
|
8 | TEMPLATE = lib | |
9 | TARGET = qtcommercialchartqml |
|
9 | TARGET = qtcommercialchartqml | |
10 | DESTDIR = $$CHART_BUILD_PLUGIN_DIR |
|
10 | DESTDIR = $$CHART_BUILD_PLUGIN_DIR | |
11 | CONFIG += qt plugin |
|
11 | CONFIG += qt plugin | |
12 | QT += declarative |
|
12 | QT += declarative | |
13 |
|
13 | |||
14 | contains(QT_MAJOR_VERSION, 5) { |
|
14 | contains(QT_MAJOR_VERSION, 5) { | |
15 | # TODO: QtQuick2 not supported by the implementation currently |
|
15 | # TODO: QtQuick2 not supported by the implementation currently | |
16 | DEFINES += QTQUICK2 |
|
16 | DEFINES += QTQUICK2 | |
17 | } |
|
17 | } | |
18 |
|
18 | |||
19 | OBJECTS_DIR = $$CHART_BUILD_DIR/plugin |
|
19 | OBJECTS_DIR = $$CHART_BUILD_DIR/plugin | |
20 | MOC_DIR = $$CHART_BUILD_DIR/plugin |
|
20 | MOC_DIR = $$CHART_BUILD_DIR/plugin | |
21 | UI_DIR = $$CHART_BUILD_DIR/plugin |
|
21 | UI_DIR = $$CHART_BUILD_DIR/plugin | |
22 | RCC_DIR = $$CHART_BUILD_DIR/plugin |
|
22 | RCC_DIR = $$CHART_BUILD_DIR/plugin | |
23 |
|
23 | |||
24 | SOURCES += \ |
|
24 | SOURCES += \ | |
25 | plugin.cpp \ |
|
25 | plugin.cpp \ | |
26 | declarativechart.cpp \ |
|
26 | declarativechart.cpp \ | |
27 | declarativeseries.cpp \ |
|
|||
28 | declarativescatterseries.cpp \ |
|
27 | declarativescatterseries.cpp \ | |
29 | scatterelement.cpp \ |
|
28 | scatterelement.cpp \ | |
30 | declarativepieseries.cpp \ |
|
29 | declarativepieseries.cpp \ | |
31 | declarativelineseries.cpp |
|
30 | declarativelineseries.cpp | |
32 | HEADERS += \ |
|
31 | HEADERS += \ | |
33 | declarativechart.h \ |
|
32 | declarativechart.h \ | |
34 | declarativeseries.h \ |
|
|||
35 | declarativescatterseries.h \ |
|
33 | declarativescatterseries.h \ | |
36 | scatterelement.h \ |
|
34 | scatterelement.h \ | |
37 | declarativepieseries.h \ |
|
35 | declarativepieseries.h \ | |
38 | declarativelineseries.h |
|
36 | declarativelineseries.h | |
39 |
|
37 | |||
40 | QMAKE_POST_LINK = $$QMAKE_COPY qmldir $$CHART_BUILD_PLUGIN_DIR |
|
38 | QMAKE_POST_LINK = $$QMAKE_COPY qmldir $$CHART_BUILD_PLUGIN_DIR | |
41 |
|
39 | |||
42 | TARGETPATH = QtCommercial/Chart |
|
40 | TARGETPATH = QtCommercial/Chart | |
43 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
41 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
44 | qmldir.files += $$PWD/qmldir |
|
42 | qmldir.files += $$PWD/qmldir | |
45 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
43 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
46 |
|
44 | |||
47 | INSTALLS += target qmldir |
|
45 | INSTALLS += target qmldir | |
48 |
|
||||
49 |
|
||||
50 |
|
||||
51 |
|
||||
52 |
|
||||
53 |
|
||||
54 |
|
||||
55 |
|
||||
56 |
|
||||
57 |
|
||||
58 |
|
||||
59 |
|
||||
60 |
|
||||
61 |
|
||||
62 |
|
||||
63 |
|
||||
64 |
|
||||
65 |
|
||||
66 |
|
||||
67 |
|
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now