@@ -69,10 +69,12 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
69 | QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent,wFlags), |
|
69 | QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent,wFlags), | |
70 | d_ptr(new QChartPrivate(this)) |
|
70 | d_ptr(new QChartPrivate(this)) | |
71 | { |
|
71 | { | |
|
72 | //setMinimumSize(200,200); | |||
72 | d_ptr->m_legend = new QLegend(this); |
|
73 | d_ptr->m_legend = new QLegend(this); | |
73 | d_ptr->m_dataset = new ChartDataSet(this); |
|
74 | d_ptr->m_dataset = new ChartDataSet(this); | |
74 | d_ptr->m_presenter = new ChartPresenter(this,d_ptr->m_dataset); |
|
75 | d_ptr->m_presenter = new ChartPresenter(this,d_ptr->m_dataset); | |
75 |
|
76 | int padding = d_ptr->m_presenter->padding(); | ||
|
77 | setMinimumSize(3*padding,3*padding); | |||
76 | connect(d_ptr->m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),d_ptr->m_legend,SLOT(handleSeriesAdded(QSeries*,Domain*))); |
|
78 | connect(d_ptr->m_dataset,SIGNAL(seriesAdded(QSeries*,Domain*)),d_ptr->m_legend,SLOT(handleSeriesAdded(QSeries*,Domain*))); | |
77 | connect(d_ptr->m_dataset,SIGNAL(seriesRemoved(QSeries*)),d_ptr->m_legend,SLOT(handleSeriesRemoved(QSeries*))); |
|
79 | connect(d_ptr->m_dataset,SIGNAL(seriesRemoved(QSeries*)),d_ptr->m_legend,SLOT(handleSeriesRemoved(QSeries*))); | |
78 | } |
|
80 | } |
@@ -60,7 +60,6 QChartView::QChartView(QChart *chart,QWidget *parent) : | |||||
60 | d_ptr->m_scene = new QGraphicsScene(this); |
|
60 | d_ptr->m_scene = new QGraphicsScene(this); | |
61 | d_ptr->m_chart = chart; |
|
61 | d_ptr->m_chart = chart; | |
62 | d_ptr->m_presenter = chart->d_ptr->m_presenter; |
|
62 | d_ptr->m_presenter = chart->d_ptr->m_presenter; | |
63 |
|
||||
64 | setFrameShape(QFrame::NoFrame); |
|
63 | setFrameShape(QFrame::NoFrame); | |
65 | setBackgroundRole(QPalette::Window); |
|
64 | setBackgroundRole(QPalette::Window); | |
66 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
65 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
@@ -207,8 +206,9 void QChartView::keyPressEvent(QKeyEvent *event) | |||||
207 | */ |
|
206 | */ | |
208 | void QChartView::resizeEvent(QResizeEvent *event) |
|
207 | void QChartView::resizeEvent(QResizeEvent *event) | |
209 | { |
|
208 | { | |
210 | d_ptr->m_chart->resize(size()); |
|
|||
211 | QGraphicsView::resizeEvent(event); |
|
209 | QGraphicsView::resizeEvent(event); | |
|
210 | d_ptr->m_chart->resize(size()); | |||
|
211 | setSceneRect(d_ptr->m_chart->geometry()); | |||
212 | } |
|
212 | } | |
213 |
|
213 | |||
214 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
214 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
General Comments 0
You need to be logged in to leave comments.
Login now