@@ -7,16 +7,15 | |||||
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | QChartWidget::QChartWidget(QWidget *parent) : |
|
9 | QChartWidget::QChartWidget(QWidget *parent) : | |
10 |
Q |
|
10 | QGraphicsView(parent) | |
11 | { |
|
11 | { | |
12 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
12 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
13 | m_scene = new QGraphicsScene(); |
|
13 | m_scene = new QGraphicsScene(); | |
14 | m_view = new QGraphicsView(parent); |
|
14 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
15 | m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
15 | setScene(m_scene); | |
16 | m_view->setScene(m_scene); |
|
|||
17 | m_chart = new QChart(); |
|
16 | m_chart = new QChart(); | |
18 | m_scene->addItem(m_chart); |
|
17 | m_scene->addItem(m_chart); | |
19 |
|
|
18 | show(); | |
20 | } |
|
19 | } | |
21 |
|
20 | |||
22 | QChartWidget::~QChartWidget() |
|
21 | QChartWidget::~QChartWidget() | |
@@ -25,7 +24,6 QChartWidget::~QChartWidget() | |||||
25 |
|
24 | |||
26 | void QChartWidget::resizeEvent(QResizeEvent *event) |
|
25 | void QChartWidget::resizeEvent(QResizeEvent *event) | |
27 | { |
|
26 | { | |
28 | m_view->resize(size().width(),size().height()); |
|
|||
29 | m_scene->setSceneRect(0,0,size().width(),size().height()); |
|
27 | m_scene->setSceneRect(0,0,size().width(),size().height()); | |
30 | m_chart->setSize(size()); |
|
28 | m_chart->setSize(size()); | |
31 | QWidget::resizeEvent(event); |
|
29 | QWidget::resizeEvent(event); |
@@ -3,9 +3,8 | |||||
3 |
|
3 | |||
4 | #include "qchartglobal.h" |
|
4 | #include "qchartglobal.h" | |
5 | #include "qchart.h" |
|
5 | #include "qchart.h" | |
6 |
#include <Q |
|
6 | #include <QGraphicsView> | |
7 |
|
7 | |||
8 | class QGraphicsView; |
|
|||
9 | class QGraphicsScene; |
|
8 | class QGraphicsScene; | |
10 |
|
9 | |||
11 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
@@ -13,7 +12,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
13 | class QChartSeries; |
|
12 | class QChartSeries; | |
14 | class QChartWidgetPrivate; |
|
13 | class QChartWidgetPrivate; | |
15 |
|
14 | |||
16 |
class QTCOMMERCIALCHART_EXPORT QChartWidget : public Q |
|
15 | class QTCOMMERCIALCHART_EXPORT QChartWidget : public QGraphicsView | |
17 | { |
|
16 | { | |
18 | Q_OBJECT |
|
17 | Q_OBJECT | |
19 | public: |
|
18 | public: | |
@@ -30,7 +29,6 public: | |||||
30 |
|
29 | |||
31 | private: |
|
30 | private: | |
32 | Q_DISABLE_COPY(QChartWidget) |
|
31 | Q_DISABLE_COPY(QChartWidget) | |
33 | QGraphicsView *m_view; |
|
|||
34 | QGraphicsScene *m_scene; |
|
32 | QGraphicsScene *m_scene; | |
35 | QChart* m_chart; |
|
33 | QChart* m_chart; | |
36 |
|
34 |
General Comments 0
You need to be logged in to leave comments.
Login now