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