@@ -1,502 +1,560 | |||||
1 | #include <QtGui/QApplication> |
|
1 | #include <QtGui/QApplication> | |
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <qchartglobal.h> |
|
3 | #include <qchartglobal.h> | |
4 | #include <qchartview.h> |
|
4 | #include <qchartview.h> | |
5 | #include <qpieseries.h> |
|
5 | #include <qpieseries.h> | |
6 | #include <qpieslice.h> |
|
6 | #include <qpieslice.h> | |
7 | #include <QGridLayout> |
|
7 | #include <QGridLayout> | |
8 | #include <QFormLayout> |
|
8 | #include <QFormLayout> | |
9 | #include <QComboBox> |
|
9 | #include <QComboBox> | |
10 | #include <QSpinBox> |
|
10 | #include <QSpinBox> | |
11 | #include <QCheckBox> |
|
11 | #include <QCheckBox> | |
12 | #include <QGroupBox> |
|
12 | #include <QGroupBox> | |
13 | #include <QLabel> |
|
13 | #include <QLabel> | |
14 | #include <QPushButton> |
|
14 | #include <QPushButton> | |
15 | #include <QColorDialog> |
|
15 | #include <QColorDialog> | |
16 | #include <QFontDialog> |
|
16 | #include <QFontDialog> | |
17 |
|
17 | |||
18 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
18 | QTCOMMERCIALCHART_USE_NAMESPACE | |
19 |
|
19 | |||
20 | class PenTool : public QWidget |
|
20 | class PenTool : public QWidget | |
21 | { |
|
21 | { | |
22 | Q_OBJECT |
|
22 | Q_OBJECT | |
23 |
|
23 | |||
24 | public: |
|
24 | public: | |
25 | explicit PenTool(QString title, QWidget *parent = 0) |
|
25 | explicit PenTool(QString title, QWidget *parent = 0) | |
26 | :QWidget(parent) |
|
26 | :QWidget(parent) | |
27 | { |
|
27 | { | |
28 | setWindowTitle(title); |
|
28 | setWindowTitle(title); | |
29 | setWindowFlags(Qt::Tool); |
|
29 | setWindowFlags(Qt::Tool); | |
30 |
|
30 | |||
31 | m_colorButton = new QPushButton(); |
|
31 | m_colorButton = new QPushButton(); | |
|
32 | ||||
32 | m_widthSpinBox = new QDoubleSpinBox(); |
|
33 | m_widthSpinBox = new QDoubleSpinBox(); | |
33 |
|
34 | |||
|
35 | m_styleCombo = new QComboBox(); | |||
|
36 | m_styleCombo->addItem("NoPen"); | |||
|
37 | m_styleCombo->addItem("SolidLine"); | |||
|
38 | m_styleCombo->addItem("DashLine"); | |||
|
39 | m_styleCombo->addItem("DotLine"); | |||
|
40 | m_styleCombo->addItem("DashDotLine"); | |||
|
41 | m_styleCombo->addItem("DashDotDotLine"); | |||
|
42 | ||||
|
43 | m_capStyleCombo = new QComboBox(); | |||
|
44 | m_capStyleCombo->addItem("FlatCap", Qt::FlatCap); | |||
|
45 | m_capStyleCombo->addItem("SquareCap", Qt::SquareCap); | |||
|
46 | m_capStyleCombo->addItem("RoundCap", Qt::RoundCap); | |||
|
47 | ||||
|
48 | m_joinStyleCombo = new QComboBox(); | |||
|
49 | m_joinStyleCombo->addItem("MiterJoin", Qt::MiterJoin); | |||
|
50 | m_joinStyleCombo->addItem("BevelJoin", Qt::BevelJoin); | |||
|
51 | m_joinStyleCombo->addItem("RoundJoin", Qt::RoundJoin); | |||
|
52 | m_joinStyleCombo->addItem("SvgMiterJoin", Qt::SvgMiterJoin); | |||
|
53 | ||||
34 | QFormLayout *layout = new QFormLayout(); |
|
54 | QFormLayout *layout = new QFormLayout(); | |
35 | layout->addRow("Color", m_colorButton); |
|
55 | layout->addRow("Color", m_colorButton); | |
36 | layout->addRow("Width", m_widthSpinBox); |
|
56 | layout->addRow("Width", m_widthSpinBox); | |
|
57 | layout->addRow("Style", m_styleCombo); | |||
|
58 | layout->addRow("Cap style", m_capStyleCombo); | |||
|
59 | layout->addRow("Join style", m_joinStyleCombo); | |||
37 | setLayout(layout); |
|
60 | setLayout(layout); | |
38 |
|
61 | |||
39 | connect(m_colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); |
|
62 | connect(m_colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); | |
40 | connect(m_widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateWidth(double))); |
|
63 | connect(m_widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateWidth(double))); | |
|
64 | connect(m_styleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStyle(int))); | |||
|
65 | connect(m_capStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCapStyle(int))); | |||
|
66 | connect(m_joinStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateJoinStyle(int))); | |||
41 | } |
|
67 | } | |
42 |
|
68 | |||
43 | void setPen(QPen pen) |
|
69 | void setPen(QPen pen) | |
44 | { |
|
70 | { | |
45 | m_pen = pen; |
|
71 | m_pen = pen; | |
46 | m_colorButton->setText(m_pen.color().name()); |
|
72 | m_colorButton->setText(m_pen.color().name()); | |
47 | m_widthSpinBox->setValue(m_pen.widthF()); |
|
73 | m_widthSpinBox->setValue(m_pen.widthF()); | |
|
74 | m_styleCombo->setCurrentIndex(m_pen.style()); // index matches the enum | |||
|
75 | m_capStyleCombo->setCurrentIndex(m_capStyleCombo->findData(m_pen.capStyle())); | |||
|
76 | m_joinStyleCombo->setCurrentIndex(m_joinStyleCombo->findData(m_pen.joinStyle())); | |||
48 | } |
|
77 | } | |
49 |
|
78 | |||
50 | QPen pen() const |
|
79 | QPen pen() const | |
51 | { |
|
80 | { | |
52 | return m_pen; |
|
81 | return m_pen; | |
53 | } |
|
82 | } | |
54 |
|
83 | |||
55 | QString name() |
|
84 | QString name() | |
56 | { |
|
85 | { | |
57 | return name(m_pen); |
|
86 | return name(m_pen); | |
58 | } |
|
87 | } | |
59 |
|
88 | |||
60 | static QString name(const QPen &pen) |
|
89 | static QString name(const QPen &pen) | |
61 | { |
|
90 | { | |
62 | return pen.color().name() + ":" + QString::number(pen.widthF()); |
|
91 | return pen.color().name() + ":" + QString::number(pen.widthF()); | |
63 | } |
|
92 | } | |
64 |
|
93 | |||
65 | Q_SIGNALS: |
|
94 | Q_SIGNALS: | |
66 | void changed(); |
|
95 | void changed(); | |
67 |
|
96 | |||
68 | public Q_SLOTS: |
|
97 | public Q_SLOTS: | |
69 |
|
98 | |||
70 | void showColorDialog() |
|
99 | void showColorDialog() | |
71 | { |
|
100 | { | |
72 | QColorDialog dialog(m_pen.color()); |
|
101 | QColorDialog dialog(m_pen.color()); | |
73 | dialog.show(); |
|
102 | dialog.show(); | |
74 | dialog.exec(); |
|
103 | dialog.exec(); | |
75 | m_pen.setColor(dialog.selectedColor()); |
|
104 | m_pen.setColor(dialog.selectedColor()); | |
76 | m_colorButton->setText(m_pen.color().name()); |
|
105 | m_colorButton->setText(m_pen.color().name()); | |
77 | emit changed(); |
|
106 | emit changed(); | |
78 | } |
|
107 | } | |
79 |
|
108 | |||
80 | void updateWidth(double width) |
|
109 | void updateWidth(double width) | |
81 | { |
|
110 | { | |
82 | if (width != m_pen.widthF()) { |
|
111 | if (width != m_pen.widthF()) { | |
83 | m_pen.setWidthF(width); |
|
112 | m_pen.setWidthF(width); | |
84 | emit changed(); |
|
113 | emit changed(); | |
85 | } |
|
114 | } | |
86 | } |
|
115 | } | |
87 |
|
116 | |||
|
117 | void updateStyle(int style) | |||
|
118 | { | |||
|
119 | if (m_pen.style() != style) { | |||
|
120 | m_pen.setStyle((Qt::PenStyle) style); | |||
|
121 | emit changed(); | |||
|
122 | } | |||
|
123 | } | |||
|
124 | ||||
|
125 | void updateCapStyle(int index) | |||
|
126 | { | |||
|
127 | Qt::PenCapStyle capStyle = (Qt::PenCapStyle) m_capStyleCombo->itemData(index).toInt(); | |||
|
128 | if (m_pen.capStyle() != capStyle) { | |||
|
129 | m_pen.setCapStyle(capStyle); | |||
|
130 | emit changed(); | |||
|
131 | } | |||
|
132 | } | |||
|
133 | ||||
|
134 | void updateJoinStyle(int index) | |||
|
135 | { | |||
|
136 | Qt::PenJoinStyle joinStyle = (Qt::PenJoinStyle) m_joinStyleCombo->itemData(index).toInt(); | |||
|
137 | if (m_pen.joinStyle() != joinStyle) { | |||
|
138 | m_pen.setJoinStyle(joinStyle); | |||
|
139 | emit changed(); | |||
|
140 | } | |||
|
141 | } | |||
|
142 | ||||
88 | private: |
|
143 | private: | |
89 | QPen m_pen; |
|
144 | QPen m_pen; | |
90 | QPushButton *m_colorButton; |
|
145 | QPushButton *m_colorButton; | |
91 | QDoubleSpinBox *m_widthSpinBox; |
|
146 | QDoubleSpinBox *m_widthSpinBox; | |
|
147 | QComboBox *m_styleCombo; | |||
|
148 | QComboBox *m_capStyleCombo; | |||
|
149 | QComboBox *m_joinStyleCombo; | |||
92 | }; |
|
150 | }; | |
93 |
|
151 | |||
94 | class BrushTool : public QWidget |
|
152 | class BrushTool : public QWidget | |
95 | { |
|
153 | { | |
96 | Q_OBJECT |
|
154 | Q_OBJECT | |
97 |
|
155 | |||
98 | public: |
|
156 | public: | |
99 | explicit BrushTool(QString title, QWidget *parent = 0) |
|
157 | explicit BrushTool(QString title, QWidget *parent = 0) | |
100 | :QWidget(parent) |
|
158 | :QWidget(parent) | |
101 | { |
|
159 | { | |
102 | setWindowTitle(title); |
|
160 | setWindowTitle(title); | |
103 | setWindowFlags(Qt::Tool); |
|
161 | setWindowFlags(Qt::Tool); | |
104 |
|
162 | |||
105 | m_colorButton = new QPushButton(); |
|
163 | m_colorButton = new QPushButton(); | |
106 | m_styleCombo = new QComboBox(); |
|
164 | m_styleCombo = new QComboBox(); | |
107 | m_styleCombo->addItem("Nobrush", Qt::NoBrush); |
|
165 | m_styleCombo->addItem("Nobrush", Qt::NoBrush); | |
108 | m_styleCombo->addItem("Solidpattern", Qt::SolidPattern); |
|
166 | m_styleCombo->addItem("Solidpattern", Qt::SolidPattern); | |
109 | m_styleCombo->addItem("Dense1pattern", Qt::Dense1Pattern); |
|
167 | m_styleCombo->addItem("Dense1pattern", Qt::Dense1Pattern); | |
110 | m_styleCombo->addItem("Dense2attern", Qt::Dense2Pattern); |
|
168 | m_styleCombo->addItem("Dense2attern", Qt::Dense2Pattern); | |
111 | m_styleCombo->addItem("Dense3Pattern", Qt::Dense3Pattern); |
|
169 | m_styleCombo->addItem("Dense3Pattern", Qt::Dense3Pattern); | |
112 | m_styleCombo->addItem("Dense4Pattern", Qt::Dense4Pattern); |
|
170 | m_styleCombo->addItem("Dense4Pattern", Qt::Dense4Pattern); | |
113 | m_styleCombo->addItem("Dense5Pattern", Qt::Dense5Pattern); |
|
171 | m_styleCombo->addItem("Dense5Pattern", Qt::Dense5Pattern); | |
114 | m_styleCombo->addItem("Dense6Pattern", Qt::Dense6Pattern); |
|
172 | m_styleCombo->addItem("Dense6Pattern", Qt::Dense6Pattern); | |
115 | m_styleCombo->addItem("Dense7Pattern", Qt::Dense7Pattern); |
|
173 | m_styleCombo->addItem("Dense7Pattern", Qt::Dense7Pattern); | |
116 | m_styleCombo->addItem("HorPattern", Qt::HorPattern); |
|
174 | m_styleCombo->addItem("HorPattern", Qt::HorPattern); | |
117 | m_styleCombo->addItem("VerPattern", Qt::VerPattern); |
|
175 | m_styleCombo->addItem("VerPattern", Qt::VerPattern); | |
118 | m_styleCombo->addItem("CrossPattern", Qt::CrossPattern); |
|
176 | m_styleCombo->addItem("CrossPattern", Qt::CrossPattern); | |
119 | m_styleCombo->addItem("BDiagPattern", Qt::BDiagPattern); |
|
177 | m_styleCombo->addItem("BDiagPattern", Qt::BDiagPattern); | |
120 | m_styleCombo->addItem("FDiagPattern", Qt::FDiagPattern); |
|
178 | m_styleCombo->addItem("FDiagPattern", Qt::FDiagPattern); | |
121 | m_styleCombo->addItem("DiagCrossPattern", Qt::DiagCrossPattern); |
|
179 | m_styleCombo->addItem("DiagCrossPattern", Qt::DiagCrossPattern); | |
122 |
|
180 | |||
123 | QFormLayout *layout = new QFormLayout(); |
|
181 | QFormLayout *layout = new QFormLayout(); | |
124 | layout->addRow("Color", m_colorButton); |
|
182 | layout->addRow("Color", m_colorButton); | |
125 | layout->addRow("Style", m_styleCombo); |
|
183 | layout->addRow("Style", m_styleCombo); | |
126 | setLayout(layout); |
|
184 | setLayout(layout); | |
127 |
|
185 | |||
128 | connect(m_colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); |
|
186 | connect(m_colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog())); | |
129 | connect(m_styleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStyle())); |
|
187 | connect(m_styleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateStyle())); | |
130 | } |
|
188 | } | |
131 |
|
189 | |||
132 | void setBrush(QBrush brush) |
|
190 | void setBrush(QBrush brush) | |
133 | { |
|
191 | { | |
134 | m_brush = brush; |
|
192 | m_brush = brush; | |
135 | m_colorButton->setText(m_brush.color().name()); |
|
193 | m_colorButton->setText(m_brush.color().name()); | |
136 | m_styleCombo->setCurrentIndex(m_brush.style()); // index matches the enum |
|
194 | m_styleCombo->setCurrentIndex(m_brush.style()); // index matches the enum | |
137 | } |
|
195 | } | |
138 |
|
196 | |||
139 | QBrush brush() const |
|
197 | QBrush brush() const | |
140 | { |
|
198 | { | |
141 | return m_brush; |
|
199 | return m_brush; | |
142 | } |
|
200 | } | |
143 |
|
201 | |||
144 | QString name() |
|
202 | QString name() | |
145 | { |
|
203 | { | |
146 | return name(m_brush); |
|
204 | return name(m_brush); | |
147 | } |
|
205 | } | |
148 |
|
206 | |||
149 | static QString name(const QBrush &brush) |
|
207 | static QString name(const QBrush &brush) | |
150 | { |
|
208 | { | |
151 | return brush.color().name(); |
|
209 | return brush.color().name(); | |
152 | } |
|
210 | } | |
153 |
|
211 | |||
154 | Q_SIGNALS: |
|
212 | Q_SIGNALS: | |
155 | void changed(); |
|
213 | void changed(); | |
156 |
|
214 | |||
157 | public Q_SLOTS: |
|
215 | public Q_SLOTS: | |
158 |
|
216 | |||
159 | void showColorDialog() |
|
217 | void showColorDialog() | |
160 | { |
|
218 | { | |
161 | QColorDialog dialog(m_brush.color()); |
|
219 | QColorDialog dialog(m_brush.color()); | |
162 | dialog.show(); |
|
220 | dialog.show(); | |
163 | dialog.exec(); |
|
221 | dialog.exec(); | |
164 | m_brush.setColor(dialog.selectedColor()); |
|
222 | m_brush.setColor(dialog.selectedColor()); | |
165 | m_colorButton->setText(m_brush.color().name()); |
|
223 | m_colorButton->setText(m_brush.color().name()); | |
166 | emit changed(); |
|
224 | emit changed(); | |
167 | } |
|
225 | } | |
168 |
|
226 | |||
169 | void updateStyle() |
|
227 | void updateStyle() | |
170 | { |
|
228 | { | |
171 | Qt::BrushStyle style = (Qt::BrushStyle) m_styleCombo->itemData(m_styleCombo->currentIndex()).toInt(); |
|
229 | Qt::BrushStyle style = (Qt::BrushStyle) m_styleCombo->itemData(m_styleCombo->currentIndex()).toInt(); | |
172 | if (m_brush.style() != style) { |
|
230 | if (m_brush.style() != style) { | |
173 | m_brush.setStyle(style); |
|
231 | m_brush.setStyle(style); | |
174 | emit changed(); |
|
232 | emit changed(); | |
175 | } |
|
233 | } | |
176 | } |
|
234 | } | |
177 |
|
235 | |||
178 | private: |
|
236 | private: | |
179 | QBrush m_brush; |
|
237 | QBrush m_brush; | |
180 | QPushButton *m_colorButton; |
|
238 | QPushButton *m_colorButton; | |
181 | QComboBox *m_styleCombo; |
|
239 | QComboBox *m_styleCombo; | |
182 | }; |
|
240 | }; | |
183 |
|
241 | |||
184 | class CustomSlice : public QPieSlice |
|
242 | class CustomSlice : public QPieSlice | |
185 | { |
|
243 | { | |
186 | Q_OBJECT |
|
244 | Q_OBJECT | |
187 | public: |
|
245 | public: | |
188 | CustomSlice(qreal value, QString label) |
|
246 | CustomSlice(qreal value, QString label) | |
189 | :QPieSlice(value, label) |
|
247 | :QPieSlice(value, label) | |
190 | { |
|
248 | { | |
191 | connect(this, SIGNAL(hoverEnter()), this, SLOT(handleHoverEnter())); |
|
249 | connect(this, SIGNAL(hoverEnter()), this, SLOT(handleHoverEnter())); | |
192 | connect(this, SIGNAL(hoverLeave()), this, SLOT(handleHoverLeave())); |
|
250 | connect(this, SIGNAL(hoverLeave()), this, SLOT(handleHoverLeave())); | |
193 | } |
|
251 | } | |
194 |
|
252 | |||
195 | public: |
|
253 | public: | |
196 | QBrush originalBrush() |
|
254 | QBrush originalBrush() | |
197 | { |
|
255 | { | |
198 | return m_originalBrush; |
|
256 | return m_originalBrush; | |
199 | } |
|
257 | } | |
200 |
|
258 | |||
201 | public Q_SLOTS: |
|
259 | public Q_SLOTS: | |
202 |
|
260 | |||
203 | void handleHoverEnter() |
|
261 | void handleHoverEnter() | |
204 | { |
|
262 | { | |
205 | QBrush brush = this->sliceBrush(); |
|
263 | QBrush brush = this->sliceBrush(); | |
206 | m_originalBrush = brush; |
|
264 | m_originalBrush = brush; | |
207 | brush.setColor(brush.color().lighter()); |
|
265 | brush.setColor(brush.color().lighter()); | |
208 | setSliceBrush(brush); |
|
266 | setSliceBrush(brush); | |
209 | } |
|
267 | } | |
210 |
|
268 | |||
211 | void handleHoverLeave() |
|
269 | void handleHoverLeave() | |
212 | { |
|
270 | { | |
213 | setSliceBrush(m_originalBrush); |
|
271 | setSliceBrush(m_originalBrush); | |
214 | } |
|
272 | } | |
215 |
|
273 | |||
216 | private: |
|
274 | private: | |
217 | QBrush m_originalBrush; |
|
275 | QBrush m_originalBrush; | |
218 | }; |
|
276 | }; | |
219 |
|
277 | |||
220 | class MainWidget : public QWidget |
|
278 | class MainWidget : public QWidget | |
221 | { |
|
279 | { | |
222 | Q_OBJECT |
|
280 | Q_OBJECT | |
223 |
|
281 | |||
224 | public: |
|
282 | public: | |
225 | explicit MainWidget(QWidget* parent = 0) |
|
283 | explicit MainWidget(QWidget* parent = 0) | |
226 | :QWidget(parent), |
|
284 | :QWidget(parent), | |
227 | m_slice(0) |
|
285 | m_slice(0) | |
228 | { |
|
286 | { | |
229 | // create chart |
|
287 | // create chart | |
230 | m_chartView = new QChartView(); |
|
288 | m_chartView = new QChartView(); | |
231 | m_chartView->setChartTitle("Piechart customization"); |
|
289 | m_chartView->setChartTitle("Piechart customization"); | |
232 |
|
290 | |||
233 | // create series |
|
291 | // create series | |
234 | m_series = new QPieSeries(); |
|
292 | m_series = new QPieSeries(); | |
235 | *m_series << new CustomSlice(10.0, "Slice 1"); |
|
293 | *m_series << new CustomSlice(10.0, "Slice 1"); | |
236 | *m_series << new CustomSlice(20.0, "Slice 2"); |
|
294 | *m_series << new CustomSlice(20.0, "Slice 2"); | |
237 | *m_series << new CustomSlice(30.0, "Slice 3"); |
|
295 | *m_series << new CustomSlice(30.0, "Slice 3"); | |
238 | *m_series << new CustomSlice(40.0, "Slice 4"); |
|
296 | *m_series << new CustomSlice(40.0, "Slice 4"); | |
239 | *m_series << new CustomSlice(50.0, "Slice 5"); |
|
297 | *m_series << new CustomSlice(50.0, "Slice 5"); | |
240 | m_chartView->addSeries(m_series); |
|
298 | m_chartView->addSeries(m_series); | |
241 |
|
299 | |||
242 | connect(m_series, SIGNAL(clicked(QPieSlice*)), this, SLOT(handleSliceClicked(QPieSlice*))); |
|
300 | connect(m_series, SIGNAL(clicked(QPieSlice*)), this, SLOT(handleSliceClicked(QPieSlice*))); | |
243 |
|
301 | |||
244 | // chart settings |
|
302 | // chart settings | |
245 | m_themeComboBox = new QComboBox(); |
|
303 | m_themeComboBox = new QComboBox(); | |
246 | m_themeComboBox->addItem("Default", QChart::ChartThemeDefault); |
|
304 | m_themeComboBox->addItem("Default", QChart::ChartThemeDefault); | |
247 | m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla); |
|
305 | m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla); | |
248 | m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); |
|
306 | m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); | |
249 | m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); |
|
307 | m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); | |
250 | m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); |
|
308 | m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); | |
251 |
|
309 | |||
252 | m_aaCheckBox = new QCheckBox(); |
|
310 | m_aaCheckBox = new QCheckBox(); | |
253 |
|
311 | |||
254 | QFormLayout* chartSettingsLayout = new QFormLayout(); |
|
312 | QFormLayout* chartSettingsLayout = new QFormLayout(); | |
255 | chartSettingsLayout->addRow("Theme", m_themeComboBox); |
|
313 | chartSettingsLayout->addRow("Theme", m_themeComboBox); | |
256 | chartSettingsLayout->addRow("Antialiasing", m_aaCheckBox); |
|
314 | chartSettingsLayout->addRow("Antialiasing", m_aaCheckBox); | |
257 | QGroupBox* chartSettings = new QGroupBox("Chart"); |
|
315 | QGroupBox* chartSettings = new QGroupBox("Chart"); | |
258 | chartSettings->setLayout(chartSettingsLayout); |
|
316 | chartSettings->setLayout(chartSettingsLayout); | |
259 |
|
317 | |||
260 | connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateChartSettings())); |
|
318 | connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateChartSettings())); | |
261 | connect(m_aaCheckBox, SIGNAL(toggled(bool)), this ,SLOT(updateChartSettings())); |
|
319 | connect(m_aaCheckBox, SIGNAL(toggled(bool)), this ,SLOT(updateChartSettings())); | |
262 |
|
320 | |||
263 | // series settings |
|
321 | // series settings | |
264 | m_hPosition = new QDoubleSpinBox(); |
|
322 | m_hPosition = new QDoubleSpinBox(); | |
265 | m_hPosition->setMinimum(0.0); |
|
323 | m_hPosition->setMinimum(0.0); | |
266 | m_hPosition->setMaximum(1.0); |
|
324 | m_hPosition->setMaximum(1.0); | |
267 | m_hPosition->setSingleStep(0.1); |
|
325 | m_hPosition->setSingleStep(0.1); | |
268 | m_hPosition->setValue(m_series->pieHorizontalPosition()); |
|
326 | m_hPosition->setValue(m_series->pieHorizontalPosition()); | |
269 |
|
327 | |||
270 | m_vPosition = new QDoubleSpinBox(); |
|
328 | m_vPosition = new QDoubleSpinBox(); | |
271 | m_vPosition->setMinimum(0.0); |
|
329 | m_vPosition->setMinimum(0.0); | |
272 | m_vPosition->setMaximum(1.0); |
|
330 | m_vPosition->setMaximum(1.0); | |
273 | m_vPosition->setSingleStep(0.1); |
|
331 | m_vPosition->setSingleStep(0.1); | |
274 | m_vPosition->setValue(m_series->pieVerticalPosition()); |
|
332 | m_vPosition->setValue(m_series->pieVerticalPosition()); | |
275 |
|
333 | |||
276 | m_sizeFactor = new QDoubleSpinBox(); |
|
334 | m_sizeFactor = new QDoubleSpinBox(); | |
277 | m_sizeFactor->setMinimum(0.0); |
|
335 | m_sizeFactor->setMinimum(0.0); | |
278 | m_sizeFactor->setMaximum(1.0); |
|
336 | m_sizeFactor->setMaximum(1.0); | |
279 | m_sizeFactor->setSingleStep(0.1); |
|
337 | m_sizeFactor->setSingleStep(0.1); | |
280 | m_sizeFactor->setValue(m_series->pieSize()); |
|
338 | m_sizeFactor->setValue(m_series->pieSize()); | |
281 |
|
339 | |||
282 | m_startAngle = new QDoubleSpinBox(); |
|
340 | m_startAngle = new QDoubleSpinBox(); | |
283 | m_startAngle->setMinimum(0.0); |
|
341 | m_startAngle->setMinimum(0.0); | |
284 | m_startAngle->setMaximum(360); |
|
342 | m_startAngle->setMaximum(360); | |
285 | m_startAngle->setValue(m_series->pieStartAngle()); |
|
343 | m_startAngle->setValue(m_series->pieStartAngle()); | |
286 | m_startAngle->setSingleStep(1); |
|
344 | m_startAngle->setSingleStep(1); | |
287 |
|
345 | |||
288 | m_endAngle = new QDoubleSpinBox(); |
|
346 | m_endAngle = new QDoubleSpinBox(); | |
289 | m_endAngle->setMinimum(0.0); |
|
347 | m_endAngle->setMinimum(0.0); | |
290 | m_endAngle->setMaximum(360); |
|
348 | m_endAngle->setMaximum(360); | |
291 | m_endAngle->setValue(m_series->pieEndAngle()); |
|
349 | m_endAngle->setValue(m_series->pieEndAngle()); | |
292 | m_endAngle->setSingleStep(1); |
|
350 | m_endAngle->setSingleStep(1); | |
293 |
|
351 | |||
294 | QFormLayout* seriesSettingsLayout = new QFormLayout(); |
|
352 | QFormLayout* seriesSettingsLayout = new QFormLayout(); | |
295 | seriesSettingsLayout->addRow("Horizontal position", m_hPosition); |
|
353 | seriesSettingsLayout->addRow("Horizontal position", m_hPosition); | |
296 | seriesSettingsLayout->addRow("Vertical position", m_vPosition); |
|
354 | seriesSettingsLayout->addRow("Vertical position", m_vPosition); | |
297 | seriesSettingsLayout->addRow("Size factor", m_sizeFactor); |
|
355 | seriesSettingsLayout->addRow("Size factor", m_sizeFactor); | |
298 | seriesSettingsLayout->addRow("Start angle", m_startAngle); |
|
356 | seriesSettingsLayout->addRow("Start angle", m_startAngle); | |
299 | seriesSettingsLayout->addRow("End angle", m_endAngle); |
|
357 | seriesSettingsLayout->addRow("End angle", m_endAngle); | |
300 | QGroupBox* seriesSettings = new QGroupBox("Series"); |
|
358 | QGroupBox* seriesSettings = new QGroupBox("Series"); | |
301 | seriesSettings->setLayout(seriesSettingsLayout); |
|
359 | seriesSettings->setLayout(seriesSettingsLayout); | |
302 |
|
360 | |||
303 | connect(m_vPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
361 | connect(m_vPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
304 | connect(m_hPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
362 | connect(m_hPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
305 | connect(m_sizeFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
363 | connect(m_sizeFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
306 | connect(m_startAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
364 | connect(m_startAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
307 | connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); |
|
365 | connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings())); | |
308 |
|
366 | |||
309 | // slice settings |
|
367 | // slice settings | |
310 | m_sliceName = new QLabel("<click a slice>"); |
|
368 | m_sliceName = new QLabel("<click a slice>"); | |
311 | m_sliceValue = new QDoubleSpinBox(); |
|
369 | m_sliceValue = new QDoubleSpinBox(); | |
312 | m_sliceValue->setMaximum(1000); |
|
370 | m_sliceValue->setMaximum(1000); | |
313 | m_sliceLabelVisible = new QCheckBox(); |
|
371 | m_sliceLabelVisible = new QCheckBox(); | |
314 | m_sliceLabelArmFactor = new QDoubleSpinBox(); |
|
372 | m_sliceLabelArmFactor = new QDoubleSpinBox(); | |
315 | m_sliceLabelArmFactor->setSingleStep(0.01); |
|
373 | m_sliceLabelArmFactor->setSingleStep(0.01); | |
316 | m_sliceExploded = new QCheckBox(); |
|
374 | m_sliceExploded = new QCheckBox(); | |
317 | m_sliceExplodedFactor = new QDoubleSpinBox(); |
|
375 | m_sliceExplodedFactor = new QDoubleSpinBox(); | |
318 | m_sliceExplodedFactor->setSingleStep(0.01); |
|
376 | m_sliceExplodedFactor->setSingleStep(0.01); | |
319 | m_pen = new QPushButton(); |
|
377 | m_pen = new QPushButton(); | |
320 | m_penTool = new PenTool("Slice pen", this); |
|
378 | m_penTool = new PenTool("Slice pen", this); | |
321 | m_brush = new QPushButton(); |
|
379 | m_brush = new QPushButton(); | |
322 | m_brushTool = new BrushTool("Slice brush", this); |
|
380 | m_brushTool = new BrushTool("Slice brush", this); | |
323 | m_font = new QPushButton(); |
|
381 | m_font = new QPushButton(); | |
324 | m_labelArmPen = new QPushButton(); |
|
382 | m_labelArmPen = new QPushButton(); | |
325 | m_labelArmPenTool = new PenTool("Label arm pen", this); |
|
383 | m_labelArmPenTool = new PenTool("Label arm pen", this); | |
326 |
|
384 | |||
327 | QFormLayout* sliceSettingsLayout = new QFormLayout(); |
|
385 | QFormLayout* sliceSettingsLayout = new QFormLayout(); | |
328 | sliceSettingsLayout->addRow("Selected", m_sliceName); |
|
386 | sliceSettingsLayout->addRow("Selected", m_sliceName); | |
329 | sliceSettingsLayout->addRow("Value", m_sliceValue); |
|
387 | sliceSettingsLayout->addRow("Value", m_sliceValue); | |
330 | sliceSettingsLayout->addRow("Pen", m_pen); |
|
388 | sliceSettingsLayout->addRow("Pen", m_pen); | |
331 | sliceSettingsLayout->addRow("Brush", m_brush); |
|
389 | sliceSettingsLayout->addRow("Brush", m_brush); | |
332 | sliceSettingsLayout->addRow("Label visible", m_sliceLabelVisible); |
|
390 | sliceSettingsLayout->addRow("Label visible", m_sliceLabelVisible); | |
333 | sliceSettingsLayout->addRow("Label font", m_font); |
|
391 | sliceSettingsLayout->addRow("Label font", m_font); | |
334 | sliceSettingsLayout->addRow("Label arm pen", m_labelArmPen); |
|
392 | sliceSettingsLayout->addRow("Label arm pen", m_labelArmPen); | |
335 | sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor); |
|
393 | sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor); | |
336 | sliceSettingsLayout->addRow("Exploded", m_sliceExploded); |
|
394 | sliceSettingsLayout->addRow("Exploded", m_sliceExploded); | |
337 | sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor); |
|
395 | sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor); | |
338 | QGroupBox* sliceSettings = new QGroupBox("Slice"); |
|
396 | QGroupBox* sliceSettings = new QGroupBox("Slice"); | |
339 | sliceSettings->setLayout(sliceSettingsLayout); |
|
397 | sliceSettings->setLayout(sliceSettingsLayout); | |
340 |
|
398 | |||
341 | connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); |
|
399 | connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); | |
342 | connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show())); |
|
400 | connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show())); | |
343 | connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); |
|
401 | connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); | |
344 | connect(m_brush, SIGNAL(clicked()), m_brushTool, SLOT(show())); |
|
402 | connect(m_brush, SIGNAL(clicked()), m_brushTool, SLOT(show())); | |
345 | connect(m_brushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); |
|
403 | connect(m_brushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); | |
346 | connect(m_font, SIGNAL(clicked()), this, SLOT(showFontDialog())); |
|
404 | connect(m_font, SIGNAL(clicked()), this, SLOT(showFontDialog())); | |
347 | connect(m_labelArmPen, SIGNAL(clicked()), m_labelArmPenTool, SLOT(show())); |
|
405 | connect(m_labelArmPen, SIGNAL(clicked()), m_labelArmPenTool, SLOT(show())); | |
348 | connect(m_labelArmPenTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); |
|
406 | connect(m_labelArmPenTool, SIGNAL(changed()), this, SLOT(updateSliceSettings())); | |
349 | connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); |
|
407 | connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); | |
350 | connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); |
|
408 | connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); | |
351 | connect(m_sliceLabelArmFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); |
|
409 | connect(m_sliceLabelArmFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); | |
352 | connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); |
|
410 | connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings())); | |
353 | connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); |
|
411 | connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings())); | |
354 |
|
412 | |||
355 | // create main layout |
|
413 | // create main layout | |
356 | QVBoxLayout *settingsLayout = new QVBoxLayout(); |
|
414 | QVBoxLayout *settingsLayout = new QVBoxLayout(); | |
357 | settingsLayout->addWidget(chartSettings); |
|
415 | settingsLayout->addWidget(chartSettings); | |
358 | settingsLayout->addWidget(seriesSettings); |
|
416 | settingsLayout->addWidget(seriesSettings); | |
359 | settingsLayout->addWidget(sliceSettings); |
|
417 | settingsLayout->addWidget(sliceSettings); | |
360 | settingsLayout->addStretch(); |
|
418 | settingsLayout->addStretch(); | |
361 |
|
419 | |||
362 | QGridLayout* baseLayout = new QGridLayout(); |
|
420 | QGridLayout* baseLayout = new QGridLayout(); | |
363 | baseLayout->addLayout(settingsLayout, 0, 0); |
|
421 | baseLayout->addLayout(settingsLayout, 0, 0); | |
364 | baseLayout->addWidget(m_chartView, 0, 1); |
|
422 | baseLayout->addWidget(m_chartView, 0, 1); | |
365 | setLayout(baseLayout); |
|
423 | setLayout(baseLayout); | |
366 |
|
424 | |||
367 | updateSerieSettings(); |
|
425 | updateSerieSettings(); | |
368 | } |
|
426 | } | |
369 |
|
427 | |||
370 | public Q_SLOTS: |
|
428 | public Q_SLOTS: | |
371 |
|
429 | |||
372 | void updateChartSettings() |
|
430 | void updateChartSettings() | |
373 | { |
|
431 | { | |
374 | QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt(); |
|
432 | QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt(); | |
375 | m_chartView->setChartTheme(theme); |
|
433 | m_chartView->setChartTheme(theme); | |
376 | m_chartView->setRenderHint(QPainter::Antialiasing, m_aaCheckBox->isChecked()); |
|
434 | m_chartView->setRenderHint(QPainter::Antialiasing, m_aaCheckBox->isChecked()); | |
377 | } |
|
435 | } | |
378 |
|
436 | |||
379 | void updateSerieSettings() |
|
437 | void updateSerieSettings() | |
380 | { |
|
438 | { | |
381 | m_series->setPiePosition(m_vPosition->value(), m_hPosition->value()); |
|
439 | m_series->setPiePosition(m_vPosition->value(), m_hPosition->value()); | |
382 | m_series->setPieSize(m_sizeFactor->value()); |
|
440 | m_series->setPieSize(m_sizeFactor->value()); | |
383 | m_series->setPieStartAngle(m_startAngle->value()); |
|
441 | m_series->setPieStartAngle(m_startAngle->value()); | |
384 | m_series->setPieEndAngle(m_endAngle->value()); |
|
442 | m_series->setPieEndAngle(m_endAngle->value()); | |
385 | } |
|
443 | } | |
386 |
|
444 | |||
387 | void updateSliceSettings() |
|
445 | void updateSliceSettings() | |
388 | { |
|
446 | { | |
389 | if (!m_slice) |
|
447 | if (!m_slice) | |
390 | return; |
|
448 | return; | |
391 |
|
449 | |||
392 | m_slice->setValue(m_sliceValue->value()); |
|
450 | m_slice->setValue(m_sliceValue->value()); | |
393 |
|
451 | |||
394 | m_slice->setSlicePen(m_penTool->pen()); |
|
452 | m_slice->setSlicePen(m_penTool->pen()); | |
395 | m_slice->setSliceBrush(m_brushTool->brush()); |
|
453 | m_slice->setSliceBrush(m_brushTool->brush()); | |
396 |
|
454 | |||
397 | m_slice->setLabelArmPen(m_labelArmPenTool->pen()); |
|
455 | m_slice->setLabelArmPen(m_labelArmPenTool->pen()); | |
398 | m_slice->setLabelVisible(m_sliceLabelVisible->isChecked()); |
|
456 | m_slice->setLabelVisible(m_sliceLabelVisible->isChecked()); | |
399 | m_slice->setLabelArmLengthFactor(m_sliceLabelArmFactor->value()); |
|
457 | m_slice->setLabelArmLengthFactor(m_sliceLabelArmFactor->value()); | |
400 |
|
458 | |||
401 | m_slice->setExploded(m_sliceExploded->isChecked()); |
|
459 | m_slice->setExploded(m_sliceExploded->isChecked()); | |
402 | m_slice->setExplodeDistanceFactor(m_sliceExplodedFactor->value()); |
|
460 | m_slice->setExplodeDistanceFactor(m_sliceExplodedFactor->value()); | |
403 | } |
|
461 | } | |
404 |
|
462 | |||
405 | void handleSliceClicked(QPieSlice* slice) |
|
463 | void handleSliceClicked(QPieSlice* slice) | |
406 | { |
|
464 | { | |
407 | m_slice = static_cast<CustomSlice*>(slice); |
|
465 | m_slice = static_cast<CustomSlice*>(slice); | |
408 |
|
466 | |||
409 | // name |
|
467 | // name | |
410 | m_sliceName->setText(slice->label()); |
|
468 | m_sliceName->setText(slice->label()); | |
411 |
|
469 | |||
412 | // value |
|
470 | // value | |
413 | m_sliceValue->blockSignals(true); |
|
471 | m_sliceValue->blockSignals(true); | |
414 | m_sliceValue->setValue(slice->value()); |
|
472 | m_sliceValue->setValue(slice->value()); | |
415 | m_sliceValue->blockSignals(false); |
|
473 | m_sliceValue->blockSignals(false); | |
416 |
|
474 | |||
417 | // pen |
|
475 | // pen | |
418 | m_pen->setText(PenTool::name(m_slice->slicePen())); |
|
476 | m_pen->setText(PenTool::name(m_slice->slicePen())); | |
419 | m_penTool->setPen(m_slice->slicePen()); |
|
477 | m_penTool->setPen(m_slice->slicePen()); | |
420 |
|
478 | |||
421 | // brush |
|
479 | // brush | |
422 | m_brush->setText(m_slice->originalBrush().color().name()); |
|
480 | m_brush->setText(m_slice->originalBrush().color().name()); | |
423 | m_brushTool->setBrush(m_slice->originalBrush()); |
|
481 | m_brushTool->setBrush(m_slice->originalBrush()); | |
424 |
|
482 | |||
425 | // label |
|
483 | // label | |
426 | m_labelArmPen->setText(PenTool::name(m_slice->labelArmPen())); |
|
484 | m_labelArmPen->setText(PenTool::name(m_slice->labelArmPen())); | |
427 | m_labelArmPenTool->setPen(m_slice->labelArmPen()); |
|
485 | m_labelArmPenTool->setPen(m_slice->labelArmPen()); | |
428 | m_font->setText(slice->labelFont().toString()); |
|
486 | m_font->setText(slice->labelFont().toString()); | |
429 | m_sliceLabelVisible->blockSignals(true); |
|
487 | m_sliceLabelVisible->blockSignals(true); | |
430 | m_sliceLabelVisible->setChecked(slice->isLabelVisible()); |
|
488 | m_sliceLabelVisible->setChecked(slice->isLabelVisible()); | |
431 | m_sliceLabelVisible->blockSignals(false); |
|
489 | m_sliceLabelVisible->blockSignals(false); | |
432 | m_sliceLabelArmFactor->blockSignals(true); |
|
490 | m_sliceLabelArmFactor->blockSignals(true); | |
433 | m_sliceLabelArmFactor->setValue(slice->labelArmLengthFactor()); |
|
491 | m_sliceLabelArmFactor->setValue(slice->labelArmLengthFactor()); | |
434 | m_sliceLabelArmFactor->blockSignals(false); |
|
492 | m_sliceLabelArmFactor->blockSignals(false); | |
435 |
|
493 | |||
436 | // exploded |
|
494 | // exploded | |
437 | m_sliceExploded->blockSignals(true); |
|
495 | m_sliceExploded->blockSignals(true); | |
438 | m_sliceExploded->setChecked(slice->isExploded()); |
|
496 | m_sliceExploded->setChecked(slice->isExploded()); | |
439 | m_sliceExploded->blockSignals(false); |
|
497 | m_sliceExploded->blockSignals(false); | |
440 | m_sliceExplodedFactor->blockSignals(true); |
|
498 | m_sliceExplodedFactor->blockSignals(true); | |
441 | m_sliceExplodedFactor->setValue(slice->explodeDistanceFactor()); |
|
499 | m_sliceExplodedFactor->setValue(slice->explodeDistanceFactor()); | |
442 | m_sliceExplodedFactor->blockSignals(false); |
|
500 | m_sliceExplodedFactor->blockSignals(false); | |
443 | } |
|
501 | } | |
444 |
|
502 | |||
445 | void showFontDialog() |
|
503 | void showFontDialog() | |
446 | { |
|
504 | { | |
447 | if (!m_slice) |
|
505 | if (!m_slice) | |
448 | return; |
|
506 | return; | |
449 |
|
507 | |||
450 | QFontDialog dialog(m_slice->labelFont()); |
|
508 | QFontDialog dialog(m_slice->labelFont()); | |
451 | dialog.show(); |
|
509 | dialog.show(); | |
452 | dialog.exec(); |
|
510 | dialog.exec(); | |
453 |
|
511 | |||
454 | m_slice->setLabelFont(dialog.currentFont()); |
|
512 | m_slice->setLabelFont(dialog.currentFont()); | |
455 | m_font->setText(dialog.currentFont().toString()); |
|
513 | m_font->setText(dialog.currentFont().toString()); | |
456 | } |
|
514 | } | |
457 |
|
515 | |||
458 | private: |
|
516 | private: | |
459 | QComboBox *m_themeComboBox; |
|
517 | QComboBox *m_themeComboBox; | |
460 | QCheckBox *m_aaCheckBox; |
|
518 | QCheckBox *m_aaCheckBox; | |
461 |
|
519 | |||
462 | QChartView* m_chartView; |
|
520 | QChartView* m_chartView; | |
463 | QPieSeries* m_series; |
|
521 | QPieSeries* m_series; | |
464 | CustomSlice* m_slice; |
|
522 | CustomSlice* m_slice; | |
465 |
|
523 | |||
466 | QDoubleSpinBox* m_hPosition; |
|
524 | QDoubleSpinBox* m_hPosition; | |
467 | QDoubleSpinBox* m_vPosition; |
|
525 | QDoubleSpinBox* m_vPosition; | |
468 | QDoubleSpinBox* m_sizeFactor; |
|
526 | QDoubleSpinBox* m_sizeFactor; | |
469 | QDoubleSpinBox* m_startAngle; |
|
527 | QDoubleSpinBox* m_startAngle; | |
470 | QDoubleSpinBox* m_endAngle; |
|
528 | QDoubleSpinBox* m_endAngle; | |
471 |
|
529 | |||
472 | QLabel* m_sliceName; |
|
530 | QLabel* m_sliceName; | |
473 | QDoubleSpinBox* m_sliceValue; |
|
531 | QDoubleSpinBox* m_sliceValue; | |
474 | QCheckBox* m_sliceLabelVisible; |
|
532 | QCheckBox* m_sliceLabelVisible; | |
475 | QDoubleSpinBox* m_sliceLabelArmFactor; |
|
533 | QDoubleSpinBox* m_sliceLabelArmFactor; | |
476 | QCheckBox* m_sliceExploded; |
|
534 | QCheckBox* m_sliceExploded; | |
477 | QDoubleSpinBox* m_sliceExplodedFactor; |
|
535 | QDoubleSpinBox* m_sliceExplodedFactor; | |
478 | QPushButton *m_brush; |
|
536 | QPushButton *m_brush; | |
479 | BrushTool *m_brushTool; |
|
537 | BrushTool *m_brushTool; | |
480 | QPushButton *m_pen; |
|
538 | QPushButton *m_pen; | |
481 | PenTool *m_penTool; |
|
539 | PenTool *m_penTool; | |
482 | QPushButton *m_font; |
|
540 | QPushButton *m_font; | |
483 | QPushButton *m_labelArmPen; |
|
541 | QPushButton *m_labelArmPen; | |
484 | PenTool *m_labelArmPenTool; |
|
542 | PenTool *m_labelArmPenTool; | |
485 | }; |
|
543 | }; | |
486 |
|
544 | |||
487 | int main(int argc, char *argv[]) |
|
545 | int main(int argc, char *argv[]) | |
488 | { |
|
546 | { | |
489 | QApplication a(argc, argv); |
|
547 | QApplication a(argc, argv); | |
490 |
|
548 | |||
491 | QMainWindow window; |
|
549 | QMainWindow window; | |
492 |
|
550 | |||
493 | MainWidget* widget = new MainWidget(); |
|
551 | MainWidget* widget = new MainWidget(); | |
494 |
|
552 | |||
495 | window.setCentralWidget(widget); |
|
553 | window.setCentralWidget(widget); | |
496 | window.resize(900, 600); |
|
554 | window.resize(900, 600); | |
497 | window.show(); |
|
555 | window.show(); | |
498 |
|
556 | |||
499 | return a.exec(); |
|
557 | return a.exec(); | |
500 | } |
|
558 | } | |
501 |
|
559 | |||
502 | #include "main.moc" |
|
560 | #include "main.moc" |
General Comments 0
You need to be logged in to leave comments.
Login now