##// END OF EJS Templates
Removed series specific impl from chartwidgettest
Tero Ahola -
r446:0bdddf1eda83
parent child
Show More
@@ -49,15 +49,6 MainWidget::MainWidget(QWidget *parent) :
49 QGridLayout *mainLayout = new QGridLayout();
49 QGridLayout *mainLayout = new QGridLayout();
50 mainLayout->addLayout(grid, 0, 0);
50 mainLayout->addLayout(grid, 0, 0);
51
51
52 // Init series type specific controls
53 initPieControls();
54 mainLayout->addLayout(m_pieLayout, 2, 0);
55 // Scatter series specific settings
56 // m_scatterLayout = new QGridLayout();
57 // m_scatterLayout->addWidget(new QLabel("scatter"), 0, 0);
58 // m_scatterLayout->setEnabled(false);
59 // mainLayout->addLayout(m_scatterLayout, 1, 0);
60
61 // Add layouts and the chart widget to the main layout
52 // Add layouts and the chart widget to the main layout
62 mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
53 mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
63 setLayout(mainLayout);
54 setLayout(mainLayout);
@@ -153,33 +144,6 void MainWidget::antiAliasToggled(bool enabled)
153 m_chartView->setRenderHint(QPainter::Antialiasing, enabled);
144 m_chartView->setRenderHint(QPainter::Antialiasing, enabled);
154 }
145 }
155
146
156 void MainWidget::initPieControls()
157 {
158 // Pie series specific settings
159 // Pie size factory
160 QDoubleSpinBox *pieSizeSpin = new QDoubleSpinBox();
161 pieSizeSpin->setMinimum(LONG_MIN);
162 pieSizeSpin->setMaximum(LONG_MAX);
163 pieSizeSpin->setValue(1.0);
164 pieSizeSpin->setSingleStep(0.1);
165 connect(pieSizeSpin, SIGNAL(valueChanged(double)), this, SLOT(setPieSizeFactor(double)));
166 // Pie position
167 QComboBox *piePosCombo = new QComboBox(this);
168 piePosCombo->addItem("Maximized");
169 piePosCombo->addItem("Top left");
170 piePosCombo->addItem("Top right");
171 piePosCombo->addItem("Bottom left");
172 piePosCombo->addItem("Bottom right");
173 connect(piePosCombo, SIGNAL(currentIndexChanged(int)),
174 this, SLOT(setPiePosition(int)));
175 m_pieLayout = new QGridLayout();
176 m_pieLayout->setEnabled(false);
177 m_pieLayout->addWidget(new QLabel("Pie size factor"), 0, 0);
178 m_pieLayout->addWidget(pieSizeSpin, 0, 1);
179 m_pieLayout->addWidget(new QLabel("Pie position"), 1, 0);
180 m_pieLayout->addWidget(piePosCombo, 1, 1);
181 }
182
183 void MainWidget::addSeries()
147 void MainWidget::addSeries()
184 {
148 {
185 if (!m_addSerieDialog) {
149 if (!m_addSerieDialog) {
@@ -376,17 +340,3 void MainWidget::changeChartTheme(int themeIndex)
376 s.setWidth(s.width()+1);
340 s.setWidth(s.width()+1);
377 resize(s);
341 resize(s);
378 }
342 }
379
380 void MainWidget::setPieSizeFactor(double size)
381 {
382 QPieSeries *pie = qobject_cast<QPieSeries *>(m_currentSeries);
383 if (pie)
384 pie->setSizeFactor(qreal(size));
385 }
386
387 void MainWidget::setPiePosition(int position)
388 {
389 QPieSeries *pie = qobject_cast<QPieSeries *>(m_currentSeries);
390 if (pie)
391 pie->setPosition((QPieSeries::PiePosition) position);
392 }
@@ -27,7 +27,6 private:
27 void initScaleControls(QGridLayout *grid);
27 void initScaleControls(QGridLayout *grid);
28 void initThemeCombo(QGridLayout *grid);
28 void initThemeCombo(QGridLayout *grid);
29 void initCheckboxes(QGridLayout *grid);
29 void initCheckboxes(QGridLayout *grid);
30 void initPieControls();
31
30
32 private slots:
31 private slots:
33 void addSeries();
32 void addSeries();
@@ -41,8 +40,6 private slots:
41 void antiAliasToggled(bool enabled);
40 void antiAliasToggled(bool enabled);
42 void setCurrentSeries(QSeries *series);
41 void setCurrentSeries(QSeries *series);
43 void changeChartTheme(int themeIndex);
42 void changeChartTheme(int themeIndex);
44 void setPieSizeFactor(double margin);
45 void setPiePosition(int position);
46 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
43 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
47 QStringList generateLabels(int count);
44 QStringList generateLabels(int count);
48
45
@@ -57,7 +54,6 private:
57 QString m_defaultSeriesName;
54 QString m_defaultSeriesName;
58 QSeries *m_currentSeries;
55 QSeries *m_currentSeries;
59 QGridLayout *m_scatterLayout;
56 QGridLayout *m_scatterLayout;
60 QGridLayout *m_pieLayout;
61 };
57 };
62
58
63 #endif // MAINWIDGET_H
59 #endif // MAINWIDGET_H
General Comments 0
You need to be logged in to leave comments. Login now