@@ -24,7 +24,7 | |||||
24 | #include <QPushButton> |
|
24 | #include <QPushButton> | |
25 | #include <QComboBox> |
|
25 | #include <QComboBox> | |
26 | #include <QCheckBox> |
|
26 | #include <QCheckBox> | |
27 |
#include <QL |
|
27 | #include <QLineEdit> | |
28 | #include <QGroupBox> |
|
28 | #include <QGroupBox> | |
29 | #include <QDoubleSpinBox> |
|
29 | #include <QDoubleSpinBox> | |
30 | #include <QFormLayout> |
|
30 | #include <QFormLayout> | |
@@ -117,6 +117,7 MainWidget::MainWidget(QWidget* parent) | |||||
117 |
|
117 | |||
118 | QPushButton *appendSlice = new QPushButton("Append slice"); |
|
118 | QPushButton *appendSlice = new QPushButton("Append slice"); | |
119 | QPushButton *insertSlice = new QPushButton("Insert slice"); |
|
119 | QPushButton *insertSlice = new QPushButton("Insert slice"); | |
|
120 | QPushButton *removeSlice = new QPushButton("Remove selected slice"); | |||
120 |
|
121 | |||
121 | QFormLayout* seriesSettingsLayout = new QFormLayout(); |
|
122 | QFormLayout* seriesSettingsLayout = new QFormLayout(); | |
122 | seriesSettingsLayout->addRow("Horizontal position", m_hPosition); |
|
123 | seriesSettingsLayout->addRow("Horizontal position", m_hPosition); | |
@@ -126,6 +127,7 MainWidget::MainWidget(QWidget* parent) | |||||
126 | seriesSettingsLayout->addRow("End angle", m_endAngle); |
|
127 | seriesSettingsLayout->addRow("End angle", m_endAngle); | |
127 | seriesSettingsLayout->addRow(appendSlice); |
|
128 | seriesSettingsLayout->addRow(appendSlice); | |
128 | seriesSettingsLayout->addRow(insertSlice); |
|
129 | seriesSettingsLayout->addRow(insertSlice); | |
|
130 | seriesSettingsLayout->addRow(removeSlice); | |||
129 | QGroupBox* seriesSettings = new QGroupBox("Series"); |
|
131 | QGroupBox* seriesSettings = new QGroupBox("Series"); | |
130 | seriesSettings->setLayout(seriesSettingsLayout); |
|
132 | seriesSettings->setLayout(seriesSettingsLayout); | |
131 |
|
133 | |||
@@ -136,9 +138,11 MainWidget::MainWidget(QWidget* parent) | |||||
136 | connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
138 | connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
137 | connect(appendSlice, SIGNAL(clicked()), this, SLOT(appendSlice())); |
|
139 | connect(appendSlice, SIGNAL(clicked()), this, SLOT(appendSlice())); | |
138 | connect(insertSlice, SIGNAL(clicked()), this, SLOT(insertSlice())); |
|
140 | connect(insertSlice, SIGNAL(clicked()), this, SLOT(insertSlice())); | |
|
141 | connect(removeSlice, SIGNAL(clicked()), this, SLOT(removeSlice())); | |||
139 |
|
142 | |||
140 | // slice settings |
|
143 | // slice settings | |
141 |
m_sliceName = new QL |
|
144 | m_sliceName = new QLineEdit("<click a slice>"); | |
|
145 | m_sliceName->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); | |||
142 | m_sliceValue = new QDoubleSpinBox(); |
|
146 | m_sliceValue = new QDoubleSpinBox(); | |
143 | m_sliceValue->setMaximum(1000); |
|
147 | m_sliceValue->setMaximum(1000); | |
144 | m_sliceLabelVisible = new QCheckBox(); |
|
148 | m_sliceLabelVisible = new QCheckBox(); | |
@@ -157,10 +161,9 MainWidget::MainWidget(QWidget* parent) | |||||
157 | m_labelPosition = new QComboBox(this); |
|
161 | m_labelPosition = new QComboBox(this); | |
158 | m_labelPosition->addItem("Outside", QPieSlice::LabelOutside); |
|
162 | m_labelPosition->addItem("Outside", QPieSlice::LabelOutside); | |
159 | m_labelPosition->addItem("Inside", QPieSlice::LabelInside); |
|
163 | m_labelPosition->addItem("Inside", QPieSlice::LabelInside); | |
160 | QPushButton *removeSlice = new QPushButton("Remove slice"); |
|
|||
161 |
|
164 | |||
162 | QFormLayout* sliceSettingsLayout = new QFormLayout(); |
|
165 | QFormLayout* sliceSettingsLayout = new QFormLayout(); | |
163 |
sliceSettingsLayout->addRow(" |
|
166 | sliceSettingsLayout->addRow("Label", m_sliceName); | |
164 | sliceSettingsLayout->addRow("Value", m_sliceValue); |
|
167 | sliceSettingsLayout->addRow("Value", m_sliceValue); | |
165 | sliceSettingsLayout->addRow("Pen", m_pen); |
|
168 | sliceSettingsLayout->addRow("Pen", m_pen); | |
166 | sliceSettingsLayout->addRow("Brush", m_brush); |
|
169 | sliceSettingsLayout->addRow("Brush", m_brush); | |
@@ -171,10 +174,10 MainWidget::MainWidget(QWidget* parent) | |||||
171 | sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor); |
|
174 | sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor); | |
172 | sliceSettingsLayout->addRow("Exploded", m_sliceExploded); |
|
175 | sliceSettingsLayout->addRow("Exploded", m_sliceExploded); | |
173 | sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor); |
|
176 | sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor); | |
174 | sliceSettingsLayout->addRow(removeSlice); |
|
177 | QGroupBox* sliceSettings = new QGroupBox("Selected slice"); | |
175 | QGroupBox* sliceSettings = new QGroupBox("Slice"); |
|
|||
176 | sliceSettings->setLayout(sliceSettingsLayout); |
|
178 | sliceSettings->setLayout(sliceSettingsLayout); | |
177 |
|
179 | |||
|
180 | connect(m_sliceName, SIGNAL(textChanged(QString)), this, SLOT(updateSliceSettings())); | |||
178 | connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); |
|
181 | connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); | |
179 | connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show())); |
|
182 | connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show())); | |
180 | connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); |
|
183 | connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); | |
@@ -189,7 +192,6 MainWidget::MainWidget(QWidget* parent) | |||||
189 | connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); |
|
192 | connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); | |
190 | connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); |
|
193 | connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); | |
191 | connect(m_labelPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSliceSettings())); |
|
194 | connect(m_labelPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSliceSettings())); | |
192 | connect(removeSlice, SIGNAL(clicked()), this, SLOT(removeSlice())); |
|
|||
193 |
|
195 | |||
194 | // create chart view |
|
196 | // create chart view | |
195 | m_chartView = new QChartView(chart); |
|
197 | m_chartView = new QChartView(chart); | |
@@ -241,6 +243,8 void MainWidget::updateSliceSettings() | |||||
241 | if (!m_slice) |
|
243 | if (!m_slice) | |
242 | return; |
|
244 | return; | |
243 |
|
245 | |||
|
246 | m_slice->setLabel(m_sliceName->text()); | |||
|
247 | ||||
244 | m_slice->setValue(m_sliceValue->value()); |
|
248 | m_slice->setValue(m_sliceValue->value()); | |
245 |
|
249 | |||
246 | m_slice->setPen(m_penTool->pen()); |
|
250 | m_slice->setPen(m_penTool->pen()); | |
@@ -260,7 +264,9 void MainWidget::handleSliceClicked(QPieSlice* slice) | |||||
260 | m_slice = static_cast<CustomSlice*>(slice); |
|
264 | m_slice = static_cast<CustomSlice*>(slice); | |
261 |
|
265 | |||
262 | // name |
|
266 | // name | |
|
267 | m_sliceName->blockSignals(true); | |||
263 | m_sliceName->setText(slice->label()); |
|
268 | m_sliceName->setText(slice->label()); | |
|
269 | m_sliceName->blockSignals(false); | |||
264 |
|
270 | |||
265 | // value |
|
271 | // value | |
266 | m_sliceValue->blockSignals(true); |
|
272 | m_sliceValue->blockSignals(true); |
@@ -23,7 +23,7 | |||||
23 | #include <QWidget> |
|
23 | #include <QWidget> | |
24 | #include <QChartGlobal> |
|
24 | #include <QChartGlobal> | |
25 |
|
25 | |||
26 |
class QL |
|
26 | class QLineEdit; | |
27 | class QPushButton; |
|
27 | class QPushButton; | |
28 | class QCheckBox; |
|
28 | class QCheckBox; | |
29 | class QComboBox; |
|
29 | class QComboBox; | |
@@ -73,7 +73,7 private: | |||||
73 | QDoubleSpinBox* m_startAngle; |
|
73 | QDoubleSpinBox* m_startAngle; | |
74 | QDoubleSpinBox* m_endAngle; |
|
74 | QDoubleSpinBox* m_endAngle; | |
75 |
|
75 | |||
76 |
QL |
|
76 | QLineEdit* m_sliceName; | |
77 | QDoubleSpinBox* m_sliceValue; |
|
77 | QDoubleSpinBox* m_sliceValue; | |
78 | QCheckBox* m_sliceLabelVisible; |
|
78 | QCheckBox* m_sliceLabelVisible; | |
79 | QDoubleSpinBox* m_sliceLabelArmFactor; |
|
79 | QDoubleSpinBox* m_sliceLabelArmFactor; |
General Comments 0
You need to be logged in to leave comments.
Login now