@@ -0,0 +1,9 | |||||
|
1 | message( "Configuring with QtCommercialChart addon..." ) | |||
|
2 | ||||
|
3 | INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCommercialChart | |||
|
4 | ||||
|
5 | CONFIG(debug, debug|release) { | |||
|
6 | LIBS += -lQtCommercialChartd | |||
|
7 | } else { | |||
|
8 | LIBS += -lQtCommercialChart | |||
|
9 | } |
@@ -0,0 +1,25 | |||||
|
1 | #ifndef CHARTGLOBAL_H | |||
|
2 | #define CHARTGLOBAL_H | |||
|
3 | ||||
|
4 | #define QTCOMMERCIALCHART_VERSION_STR "1.0" | |||
|
5 | #define QTCOMMERCIALCHART_VERSION 0x01 | |||
|
6 | ||||
|
7 | #if defined(QTCOMMERCIALCHART_LIBRARY) | |||
|
8 | # define QTCOMMERCIALCHART_EXPORT Q_DECL_EXPORT | |||
|
9 | #else | |||
|
10 | # define QTCOMMERCIALCHART_EXPORT Q_DECL_IMPORT | |||
|
11 | #endif | |||
|
12 | ||||
|
13 | #define QTCOMMERCIALCHART_NAMESPACE QtCommercialChart | |||
|
14 | ||||
|
15 | #ifdef QTCOMMERCIALCHART_NAMESPACE | |||
|
16 | # define QTCOMMERCIALCHART_BEGIN_NAMESPACE namespace QTCOMMERCIALCHART_NAMESPACE { | |||
|
17 | # define QTCOMMERCIALCHART_END_NAMESPACE } | |||
|
18 | # define QTCOMMERCIALCHART_USE_NAMESPACE using namespace QTCOMMERCIALCHART_NAMESPACE; | |||
|
19 | #else | |||
|
20 | # define QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
21 | # define QTCOMMERCIALCHART_END_NAMESPACE | |||
|
22 | # define QTCOMMERCIALCHART_USE_NAMESPACE | |||
|
23 | #endif | |||
|
24 | ||||
|
25 | #endif |
@@ -1,11 +1,10 | |||||
1 | TEMPLATE = subdirs |
|
1 | TEMPLATE = subdirs | |
2 | SUBDIRS += src #qmlplugin |
|
2 | SUBDIRS += src #qmlplugin | |
3 |
|
3 | |||
4 | QMAKE_CXXFLAGS += -g -Wall |
|
4 | QMAKE_CXXFLAGS += -g -Wall | |
5 | QMAKE_DISTCLEAN += -r build |
|
5 | QMAKE_DISTCLEAN += -r build | |
6 |
|
6 | |||
7 | # install feature file |
|
7 | # install feature file | |
8 | feature.path = $$[QT_INSTALL_DATA]/mkspecs/features |
|
8 | feature.path = $$[QT_INSTALL_DATA]/mkspecs/features | |
9 |
feature.files = $$PWD/features/chart |
|
9 | feature.files = $$PWD/features/qtcommercialchart.prf | |
10 | INSTALLS += feature |
|
10 | INSTALLS += feature | |
11 |
|
@@ -3,6 +3,6 TEMPLATE = app | |||||
3 |
|
3 | |||
4 | QT += core gui |
|
4 | QT += core gui | |
5 |
|
5 | |||
6 |
CONFIG += chart |
|
6 | CONFIG += qtcommercialchart | |
7 |
|
7 | |||
8 | SOURCES += main.cpp |
|
8 | SOURCES += main.cpp |
@@ -5,7 +5,7 | |||||
5 | #include <qchart.h> |
|
5 | #include <qchart.h> | |
6 | #include <cmath> |
|
6 | #include <cmath> | |
7 |
|
7 | |||
8 | QCHART_USE_NAMESPACE |
|
8 | QTCOMMERCIALCHART_USE_NAMESPACE | |
9 |
|
9 | |||
10 | #define PI 3.14159265358979 |
|
10 | #define PI 3.14159265358979 | |
11 |
|
11 |
@@ -2,7 +2,7 | |||||
2 | #include <QPainter> |
|
2 | #include <QPainter> | |
3 | #include <QDebug> |
|
3 | #include <QDebug> | |
4 |
|
4 | |||
5 | QCHART_BEGIN_NAMESPACE |
|
5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
6 |
|
6 | |||
7 | Axis::Axis(QGraphicsItem* parent): QGraphicsItem(parent) |
|
7 | Axis::Axis(QGraphicsItem* parent): QGraphicsItem(parent) | |
8 | { |
|
8 | { | |
@@ -47,4 +47,4 void Axis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidg | |||||
47 | painter->restore(); |
|
47 | painter->restore(); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | QCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,10 +1,10 | |||||
1 | #ifndef AXIS_H_ |
|
1 | #ifndef AXIS_H_ | |
2 | #define AXIS_H_ |
|
2 | #define AXIS_H_ | |
3 |
|
3 | |||
4 |
#include <qchart |
|
4 | #include <qchartglobal.h> | |
5 | #include <QGraphicsItem> |
|
5 | #include <QGraphicsItem> | |
6 |
|
6 | |||
7 | QCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | class Axis: public QGraphicsItem |
|
9 | class Axis: public QGraphicsItem | |
10 | { |
|
10 | { | |
@@ -24,6 +24,6 private: | |||||
24 | QPainterPath m_path; |
|
24 | QPainterPath m_path; | |
25 | }; |
|
25 | }; | |
26 |
|
26 | |||
27 | QCHART_END_NAMESPACE |
|
27 | QTCOMMERCIALCHART_END_NAMESPACE | |
28 |
|
28 | |||
29 | #endif /* AXIS_H_ */ |
|
29 | #endif /* AXIS_H_ */ |
@@ -6,7 +6,7 | |||||
6 | #include "xygrid_p.h" |
|
6 | #include "xygrid_p.h" | |
7 | #include <QDebug> |
|
7 | #include <QDebug> | |
8 |
|
8 | |||
9 | QCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 | class QChartPrivate |
|
11 | class QChartPrivate | |
12 | { |
|
12 | { | |
@@ -72,12 +72,16 void QChart::addSeries(QChartSeries* series) | |||||
72 |
|
72 | |||
73 | switch(series->type()) |
|
73 | switch(series->type()) | |
74 | { |
|
74 | { | |
75 |
case QChartSeries:: |
|
75 | case QChartSeries::SeriesTypeLine: { | |
76 | XYLineChartItem* item = new XYLineChartItem(reinterpret_cast<QXYChartSeries*>(series),this); |
|
76 | XYLineChartItem* item = new XYLineChartItem(reinterpret_cast<QXYChartSeries*>(series),this); | |
77 | item->updateXYPlotData(d->m_plotDataList.at(0)); |
|
77 | item->updateXYPlotData(d->m_plotDataList.at(0)); | |
78 | d->m_items<<item; |
|
78 | d->m_items<<item; | |
79 | break; |
|
79 | break; | |
80 | } |
|
80 | } | |
|
81 | case QChartSeries::SeriesTypeScatter: { | |||
|
82 | break; | |||
|
83 | } | |||
|
84 | } | |||
81 | } |
|
85 | } | |
82 |
|
86 | |||
83 | void QChart::setSize(const QSizeF& size) |
|
87 | void QChart::setSize(const QSizeF& size) | |
@@ -107,6 +111,4 void QChart::setMargin(int margin) | |||||
107 | d->m_marginSize = margin; |
|
111 | d->m_marginSize = margin; | |
108 | } |
|
112 | } | |
109 |
|
113 | |||
110 |
|
114 | QTCOMMERCIALCHART_END_NAMESPACE | ||
111 |
|
||||
112 | QCHART_END_NAMESPACE |
|
@@ -1,10 +1,10 | |||||
1 | #ifndef CHART_H |
|
1 | #ifndef CHART_H | |
2 | #define CHART_H |
|
2 | #define CHART_H | |
3 |
|
3 | |||
4 |
#include <qchart |
|
4 | #include <qchartglobal.h> | |
5 | #include <QGraphicsItem> |
|
5 | #include <QGraphicsItem> | |
6 |
|
6 | |||
7 | QCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | class Axis; |
|
9 | class Axis; | |
10 | class XYGrid; |
|
10 | class XYGrid; | |
@@ -12,7 +12,7 class QChartSeries; | |||||
12 | class XYPlotDomain; |
|
12 | class XYPlotDomain; | |
13 | class QChartPrivate; |
|
13 | class QChartPrivate; | |
14 |
|
14 | |||
15 | class QCHART_EXPORT QChart : public QGraphicsItem |
|
15 | class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsItem | |
16 | { |
|
16 | { | |
17 |
|
17 | |||
18 | public: |
|
18 | public: | |
@@ -38,6 +38,6 private: | |||||
38 |
|
38 | |||
39 | }; |
|
39 | }; | |
40 |
|
40 | |||
41 | QCHART_END_NAMESPACE |
|
41 | QTCOMMERCIALCHART_END_NAMESPACE | |
42 |
|
42 | |||
43 | #endif |
|
43 | #endif |
@@ -1,16 +1,23 | |||||
1 | #ifndef QCHARTSERIES_H |
|
1 | #ifndef QCHARTSERIES_H | |
2 | #define QCHARTSERIES_H |
|
2 | #define QCHARTSERIES_H | |
3 |
|
3 | |||
4 |
#include "qchart |
|
4 | #include "qchartglobal.h" | |
5 | #include <QObject> |
|
5 | #include <QObject> | |
6 |
|
6 | |||
7 | QCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | class QCHART_EXPORT QChartSeries : public QObject |
|
9 | class QTCOMMERCIALCHART_EXPORT QChartSeries : public QObject | |
10 | { |
|
10 | { | |
11 |
|
11 | |||
12 | public: |
|
12 | public: | |
13 |
enum QChartSeriesType { |
|
13 | enum QChartSeriesType { | |
|
14 | SeriesTypeLine = 0, | |||
|
15 | // SeriesTypeArea, | |||
|
16 | // SeriesTypeBar, | |||
|
17 | // SeriesTypePie, | |||
|
18 | SeriesTypeScatter | |||
|
19 | // SeriesTypeSpline | |||
|
20 | }; | |||
14 |
|
21 | |||
15 | protected: |
|
22 | protected: | |
16 | QChartSeries(QObject *parent = 0):QObject(parent){}; |
|
23 | QChartSeries(QObject *parent = 0):QObject(parent){}; | |
@@ -25,7 +32,7 public: | |||||
25 |
|
32 | |||
26 | }; |
|
33 | }; | |
27 |
|
34 | |||
28 | QCHART_END_NAMESPACE |
|
35 | QTCOMMERCIALCHART_END_NAMESPACE | |
29 |
|
36 | |||
30 | #endif |
|
37 | #endif | |
31 |
|
38 |
@@ -4,7 +4,7 | |||||
4 | #include <QGraphicsScene> |
|
4 | #include <QGraphicsScene> | |
5 | #include <QResizeEvent> |
|
5 | #include <QResizeEvent> | |
6 |
|
6 | |||
7 | QCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | class QChartWidgetPrivate |
|
9 | class QChartWidgetPrivate | |
10 | { |
|
10 | { | |
@@ -66,4 +66,4 void QChartWidget::addSeries(QChartSeries* series) | |||||
66 |
|
66 | |||
67 | #include "moc_qchartwidget.cpp" |
|
67 | #include "moc_qchartwidget.cpp" | |
68 |
|
68 | |||
69 | QCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,16 +1,16 | |||||
1 | #ifndef QCHARTWIDGET_H |
|
1 | #ifndef QCHARTWIDGET_H | |
2 | #define QCHARTWIDGET_H |
|
2 | #define QCHARTWIDGET_H | |
3 |
|
3 | |||
4 |
#include "qchart |
|
4 | #include "qchartglobal.h" | |
5 | #include "qchart.h" |
|
5 | #include "qchart.h" | |
6 | #include <QWidget> |
|
6 | #include <QWidget> | |
7 |
|
7 | |||
8 | QCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | class QChartSeries; |
|
10 | class QChartSeries; | |
11 | class QChartWidgetPrivate; |
|
11 | class QChartWidgetPrivate; | |
12 |
|
12 | |||
13 | class QCHART_EXPORT QChartWidget : public QWidget |
|
13 | class QTCOMMERCIALCHART_EXPORT QChartWidget : public QWidget | |
14 | { |
|
14 | { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 | public: |
|
16 | public: | |
@@ -31,6 +31,6 private: | |||||
31 |
|
31 | |||
32 | }; |
|
32 | }; | |
33 |
|
33 | |||
34 | QCHART_END_NAMESPACE |
|
34 | QTCOMMERCIALCHART_END_NAMESPACE | |
35 |
|
35 | |||
36 | #endif // QCHARTWIDGET_H |
|
36 | #endif // QCHARTWIDGET_H |
@@ -1,46 +1,49 | |||||
1 | TARGET = QChart |
|
1 | TARGET = QtCommercialChart | |
2 | TEMPLATE = lib |
|
2 | TEMPLATE = lib | |
3 | QT += core \ |
|
3 | QT += core \ | |
4 | gui |
|
4 | gui | |
5 | CONFIG += debug_and_release |
|
5 | CONFIG += debug_and_release | |
6 | CONFIG(debug, debug|release):TARGET = QChartd |
|
6 | CONFIG(debug, debug|release):TARGET = QtCommercialChartd | |
7 |
|
7 | |||
8 | SOURCES += \ |
|
8 | SOURCES += \ | |
9 | xylinechart/qxychartseries.cpp \ |
|
9 | xylinechart/qxychartseries.cpp \ | |
10 | xylinechart/xylinechartitem.cpp \ |
|
10 | xylinechart/xylinechartitem.cpp \ | |
11 | xylinechart/xygrid.cpp \ |
|
11 | xylinechart/xygrid.cpp \ | |
12 | xylinechart/xyplotdomain.cpp \ |
|
12 | xylinechart/xyplotdomain.cpp \ | |
13 | qchart.cpp \ |
|
13 | qchart.cpp \ | |
14 | axis.cpp \ |
|
14 | axis.cpp \ | |
15 | qchartwidget.cpp |
|
15 | qchartwidget.cpp | |
16 |
|
16 | |||
17 | PRIVATE_HEADERS += \ |
|
17 | PRIVATE_HEADERS += \ | |
18 | xylinechart/xylinechartitem_p.h \ |
|
18 | xylinechart/xylinechartitem_p.h \ | |
19 | xylinechart/xyplotdomain_p.h \ |
|
19 | xylinechart/xyplotdomain_p.h \ | |
20 | xylinechart/xygrid_p.h \ |
|
20 | xylinechart/xygrid_p.h \ | |
21 | axis_p.h |
|
21 | axis_p.h | |
22 |
|
22 | |||
23 | PUBLIC_HEADERS += \ |
|
23 | PUBLIC_HEADERS += \ | |
24 | qchartseries.h \ |
|
24 | qchartseries.h \ | |
25 | qchart.h \ |
|
25 | qchart.h \ | |
26 | qchartwidget.h \ |
|
26 | qchartwidget.h \ | |
27 |
qchart |
|
27 | qchartglobal.h \ | |
28 | xylinechart/qxychartseries.h |
|
28 | xylinechart/qxychartseries.h | |
29 |
|
29 | |||
30 | HEADERS += $$PUBLIC_HEADERS |
|
30 | HEADERS += $$PUBLIC_HEADERS | |
31 | HEADERS += $$PRIVATE_HEADERS |
|
31 | HEADERS += $$PRIVATE_HEADERS | |
32 |
|
32 | |||
33 | INCLUDEPATH += xylinechart \ |
|
33 | INCLUDEPATH += xylinechart \ | |
34 | . |
|
34 | . | |
35 |
|
35 | |||
36 | OBJECTS_DIR = ../build/lib |
|
36 | OBJECTS_DIR = ../build/lib | |
37 | MOC_DIR = ../build/lib |
|
37 | MOC_DIR = ../build/lib | |
38 | UI_DIR = ../build/lib |
|
38 | UI_DIR = ../build/lib | |
39 | RCC_DIR = ../build/lib |
|
39 | RCC_DIR = ../build/lib | |
40 | DEFINES += QCHART_LIBRARY |
|
40 | DEFINES += QTCOMMERCIALCHART_LIBRARY | |
41 |
|
41 | |||
42 |
public_headers.path = $$[QT_INSTALL_HEADERS]/QChart |
|
42 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart | |
43 | public_headers.files = $$PUBLIC_HEADERS |
|
43 | public_headers.files = $$PUBLIC_HEADERS | |
44 | target.path = $$[QT_INSTALL_LIBS] |
|
44 | target.path = $$[QT_INSTALL_LIBS] | |
45 | INSTALLS += target \ |
|
45 | INSTALLS += target \ | |
46 | public_headers |
|
46 | public_headers | |
|
47 | ||||
|
48 | ||||
|
49 |
@@ -1,6 +1,6 | |||||
1 | #include "qxychartseries.h" |
|
1 | #include "qxychartseries.h" | |
2 |
|
2 | |||
3 | QCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | QXYChartSeries::QXYChartSeries(QObject* parent):QChartSeries(parent), |
|
5 | QXYChartSeries::QXYChartSeries(QObject* parent):QChartSeries(parent), | |
6 | m_color(Qt::black) |
|
6 | m_color(Qt::black) | |
@@ -65,4 +65,4 QDebug operator<< (QDebug debug, const QXYChartSeries series) | |||||
65 | return debug.space(); |
|
65 | return debug.space(); | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | QCHART_END_NAMESPACE |
|
68 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,14 +1,14 | |||||
1 | #ifndef QXYSERIES_H_ |
|
1 | #ifndef QXYSERIES_H_ | |
2 | #define QXYSERIES_H_ |
|
2 | #define QXYSERIES_H_ | |
3 |
|
3 | |||
4 |
#include "qchart |
|
4 | #include "qchartglobal.h" | |
5 | #include "qchartseries.h" |
|
5 | #include "qchartseries.h" | |
6 | #include <QDebug> |
|
6 | #include <QDebug> | |
7 | #include <QColor> |
|
7 | #include <QColor> | |
8 |
|
8 | |||
9 | QCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 | class QCHART_EXPORT QXYChartSeries : public QChartSeries |
|
11 | class QTCOMMERCIALCHART_EXPORT QXYChartSeries : public QChartSeries | |
12 | { |
|
12 | { | |
13 | private: |
|
13 | private: | |
14 | QXYChartSeries(QObject* parent=0); |
|
14 | QXYChartSeries(QObject* parent=0); | |
@@ -17,7 +17,7 public: | |||||
17 |
|
17 | |||
18 | //implemented from QChartSeries |
|
18 | //implemented from QChartSeries | |
19 | static QXYChartSeries* create(QObject* parent=0); |
|
19 | static QXYChartSeries* create(QObject* parent=0); | |
20 |
virtual QChartSeriesType type() const { return QChartSeries:: |
|
20 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;} | |
21 |
|
21 | |||
22 | void add(qreal x, qreal y); |
|
22 | void add(qreal x, qreal y); | |
23 | void clear(); |
|
23 | void clear(); | |
@@ -35,6 +35,6 private: | |||||
35 |
|
35 | |||
36 | }; |
|
36 | }; | |
37 |
|
37 | |||
38 | QCHART_END_NAMESPACE |
|
38 | QTCOMMERCIALCHART_END_NAMESPACE | |
39 |
|
39 | |||
40 | #endif |
|
40 | #endif |
@@ -2,7 +2,7 | |||||
2 | #include <QPainter> |
|
2 | #include <QPainter> | |
3 | #include <QDebug> |
|
3 | #include <QDebug> | |
4 |
|
4 | |||
5 | QCHART_BEGIN_NAMESPACE |
|
5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
6 |
|
6 | |||
7 | XYGrid::XYGrid(QGraphicsItem* parent):QGraphicsItem(parent) |
|
7 | XYGrid::XYGrid(QGraphicsItem* parent):QGraphicsItem(parent) | |
8 | { |
|
8 | { | |
@@ -67,4 +67,4 void XYGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWi | |||||
67 | //painter->drawRect(m_rect.adjusted(0, 0, -1, -1)); |
|
67 | //painter->drawRect(m_rect.adjusted(0, 0, -1, -1)); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | QCHART_END_NAMESPACE |
|
70 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,11 +1,11 | |||||
1 | #ifndef XYGRID_H_ |
|
1 | #ifndef XYGRID_H_ | |
2 | #define XYGRID_H_ |
|
2 | #define XYGRID_H_ | |
3 |
|
3 | |||
4 |
#include <qchart |
|
4 | #include <qchartglobal.h> | |
5 | #include <xyplotdomain_p.h> |
|
5 | #include <xyplotdomain_p.h> | |
6 | #include <QGraphicsItem> |
|
6 | #include <QGraphicsItem> | |
7 |
|
7 | |||
8 | QCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | class XYGrid : public QGraphicsItem |
|
10 | class XYGrid : public QGraphicsItem | |
11 | { |
|
11 | { | |
@@ -26,6 +26,6 private: | |||||
26 | XYPlotDomain m_xyPlotData; |
|
26 | XYPlotDomain m_xyPlotData; | |
27 | }; |
|
27 | }; | |
28 |
|
28 | |||
29 | QCHART_END_NAMESPACE |
|
29 | QTCOMMERCIALCHART_END_NAMESPACE | |
30 |
|
30 | |||
31 | #endif /* XYGRID_H_ */ |
|
31 | #endif /* XYGRID_H_ */ |
@@ -6,7 +6,7 | |||||
6 | #include <QStyleOptionGraphicsItem> |
|
6 | #include <QStyleOptionGraphicsItem> | |
7 | #include <QDebug> |
|
7 | #include <QDebug> | |
8 |
|
8 | |||
9 | QCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 | XYLineChartItem::XYLineChartItem(QXYChartSeries* series,QGraphicsItem *parent):QGraphicsItem(parent), |
|
11 | XYLineChartItem::XYLineChartItem(QXYChartSeries* series,QGraphicsItem *parent):QGraphicsItem(parent), | |
12 | m_series(series) |
|
12 | m_series(series) | |
@@ -53,4 +53,4 void XYLineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o | |||||
53 |
|
53 | |||
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | QCHART_END_NAMESPACE |
|
56 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,11 +1,11 | |||||
1 | #ifndef XYLINECHARTITEM_H |
|
1 | #ifndef XYLINECHARTITEM_H | |
2 | #define XYLINECHARTITEM_H |
|
2 | #define XYLINECHARTITEM_H | |
3 |
|
3 | |||
4 |
#include "qchart |
|
4 | #include "qchartglobal.h" | |
5 | #include "qchart.h" |
|
5 | #include "qchart.h" | |
6 | #include "xyplotdomain_p.h" |
|
6 | #include "xyplotdomain_p.h" | |
7 |
|
7 | |||
8 | QCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | class QXYChartSeries; |
|
10 | class QXYChartSeries; | |
11 |
|
11 | |||
@@ -28,6 +28,6 private: | |||||
28 | XYPlotDomain m_xyPlotData; |
|
28 | XYPlotDomain m_xyPlotData; | |
29 | }; |
|
29 | }; | |
30 |
|
30 | |||
31 | QCHART_END_NAMESPACE |
|
31 | QTCOMMERCIALCHART_END_NAMESPACE | |
32 |
|
32 | |||
33 | #endif |
|
33 | #endif |
@@ -1,6 +1,6 | |||||
1 | #include "xyplotdomain_p.h" |
|
1 | #include "xyplotdomain_p.h" | |
2 |
|
2 | |||
3 | QCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | XYPlotDomain::XYPlotDomain(): |
|
5 | XYPlotDomain::XYPlotDomain(): | |
6 | m_ticksX(0), |
|
6 | m_ticksX(0), | |
@@ -30,4 +30,4 qreal XYPlotDomain::spanY() const | |||||
30 | return m_maxY - m_minY; |
|
30 | return m_maxY - m_minY; | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | QCHART_END_NAMESPACE |
|
33 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,9 +1,9 | |||||
1 | #ifndef PLOTDOMAIN_H_ |
|
1 | #ifndef PLOTDOMAIN_H_ | |
2 | #define PLOTDOMAIN_H_ |
|
2 | #define PLOTDOMAIN_H_ | |
3 |
#include "qchart |
|
3 | #include "qchartglobal.h" | |
4 | #include <QRect> |
|
4 | #include <QRect> | |
5 |
|
5 | |||
6 | QCHART_BEGIN_NAMESPACE |
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
7 |
|
7 | |||
8 | class XYPlotDomain { |
|
8 | class XYPlotDomain { | |
9 | public: |
|
9 | public: | |
@@ -25,6 +25,6 public: | |||||
25 | QRect m_viewportRect; |
|
25 | QRect m_viewportRect; | |
26 | }; |
|
26 | }; | |
27 |
|
27 | |||
28 | QCHART_END_NAMESPACE |
|
28 | QTCOMMERCIALCHART_END_NAMESPACE | |
29 |
|
29 | |||
30 | #endif /* PLOTTER_H_ */ |
|
30 | #endif /* PLOTTER_H_ */ |
@@ -6,7 +6,7 contains(QT_MAJOR_VERSION, 5) { | |||||
6 | QT += widgets |
|
6 | QT += widgets | |
7 | } |
|
7 | } | |
8 |
|
8 | |||
9 |
CONFIG += chart |
|
9 | CONFIG += qtcommercialchart | |
10 |
|
10 | |||
11 | OBJECTS_DIR = tmp |
|
11 | OBJECTS_DIR = tmp | |
12 | MOC_DIR = tmp |
|
12 | MOC_DIR = tmp |
@@ -13,15 +13,11 | |||||
13 | #include <cmath> |
|
13 | #include <cmath> | |
14 | #include <QDebug> |
|
14 | #include <QDebug> | |
15 |
|
15 | |||
16 | QCHART_USE_NAMESPACE |
|
16 | QTCOMMERCIALCHART_USE_NAMESPACE | |
17 |
|
17 | |||
18 | MainWidget::MainWidget(QWidget *parent) : |
|
18 | MainWidget::MainWidget(QWidget *parent) : | |
19 | QWidget(parent) |
|
19 | QWidget(parent) | |
20 | { |
|
20 | { | |
21 | m_chartWidget = new QChartWidget(this); |
|
|||
22 | // m_chartWidget->resize(QSize(200,200)); |
|
|||
23 | // m_chartWidget->setColor(Qt::red); |
|
|||
24 |
|
||||
25 | QPushButton *addSeriesButton = new QPushButton("Add series"); |
|
21 | QPushButton *addSeriesButton = new QPushButton("Add series"); | |
26 | connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries())); |
|
22 | connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries())); | |
27 |
|
23 | |||
@@ -79,8 +75,11 MainWidget::MainWidget(QWidget *parent) : | |||||
79 | grid->setRowStretch(8, 1); |
|
75 | grid->setRowStretch(8, 1); | |
80 |
|
76 | |||
81 | hbox->addLayout(grid); |
|
77 | hbox->addLayout(grid); | |
|
78 | ||||
|
79 | m_chartWidget = new QChartWidget(this); | |||
|
80 | //m_chartWidget->setColor(Qt::red); | |||
82 | hbox->addWidget(m_chartWidget); |
|
81 | hbox->addWidget(m_chartWidget); | |
83 | hbox->setStretch(1, 1); |
|
82 | // hbox->setStretch(1, 1); | |
84 |
|
83 | |||
85 | setLayout(hbox); |
|
84 | setLayout(hbox); | |
86 |
|
85 | |||
@@ -101,8 +100,17 void MainWidget::addSeries(QString series, QString data) | |||||
101 | qDebug() << "addSeries: " << series << " data: " << data; |
|
100 | qDebug() << "addSeries: " << series << " data: " << data; | |
102 | m_defaultSeries = series; |
|
101 | m_defaultSeries = series; | |
103 |
|
102 | |||
|
103 | QXYChartSeries* series0 = 0; | |||
|
104 | ||||
104 | // TODO: color of the series |
|
105 | // TODO: color of the series | |
105 | QXYChartSeries* series0 = QXYChartSeries::create(); |
|
106 | if (series == "Scatter") { | |
|
107 | series0 = QXYChartSeries::create(); | |||
|
108 | } else if (series == "Line") { | |||
|
109 | series0 = QXYChartSeries::create(); | |||
|
110 | } else { | |||
|
111 | // TODO | |||
|
112 | series0 = QXYChartSeries::create(); | |||
|
113 | } | |||
106 |
|
114 | |||
107 | if (data == "linear") { |
|
115 | if (data == "linear") { | |
108 | for (int i = 0; i < 10; i++) |
|
116 | for (int i = 0; i < 10; i++) | |
@@ -124,13 +132,7 void MainWidget::addSeries(QString series, QString data) | |||||
124 | // TODO: check if data has a valid file name |
|
132 | // TODO: check if data has a valid file name | |
125 | } |
|
133 | } | |
126 |
|
134 | |||
127 | if (series == "Scatter") { |
|
135 | m_chartWidget->addSeries(series0); | |
128 | m_chartWidget->addSeries(series0); |
|
|||
129 | } else if (series == "Line") { |
|
|||
130 | m_chartWidget->addSeries(series0); |
|
|||
131 | } else { |
|
|||
132 | // TODO |
|
|||
133 | } |
|
|||
134 | } |
|
136 | } | |
135 |
|
137 | |||
136 | void MainWidget::chartTypeChanged(int itemIndex) |
|
138 | void MainWidget::chartTypeChanged(int itemIndex) |
@@ -1,14 +1,14 | |||||
1 | #ifndef MAINWIDGET_H |
|
1 | #ifndef MAINWIDGET_H | |
2 | #define MAINWIDGET_H |
|
2 | #define MAINWIDGET_H | |
3 |
|
3 | |||
4 |
#include <qchart |
|
4 | #include <qchartglobal.h> | |
5 | #include <qchartwidget.h> |
|
5 | #include <qchartwidget.h> | |
6 | #include <QWidget> |
|
6 | #include <QWidget> | |
7 |
|
7 | |||
8 | class QSpinBox; |
|
8 | class QSpinBox; | |
9 | class QCheckBox; |
|
9 | class QCheckBox; | |
10 |
|
10 | |||
11 | QCHART_USE_NAMESPACE |
|
11 | QTCOMMERCIALCHART_USE_NAMESPACE | |
12 |
|
12 | |||
13 | class MainWidget : public QWidget |
|
13 | class MainWidget : public QWidget | |
14 | { |
|
14 | { |
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