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