1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Charts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29#ifndef MAINWIDGET_H
30#define MAINWIDGET_H
31
32#include <QtWidgets/QWidget>
33#include <QtCharts/QChartGlobal>
34
35QT_BEGIN_NAMESPACE
36class QLineEdit;
37class QPushButton;
38class QCheckBox;
39class QComboBox;
40class QDoubleSpinBox;
41QT_END_NAMESPACE
42
43class PenTool;
44class BrushTool;
45class CustomSlice;
46
47QT_CHARTS_BEGIN_NAMESPACE
48class QChartView;
49class QPieSeries;
50class QPieSlice;
51QT_CHARTS_END_NAMESPACE
52
53QT_CHARTS_USE_NAMESPACE
54
55class MainWidget : public QWidget
56{
57 Q_OBJECT
58
59public:
60 explicit MainWidget(QWidget *parent = 0);
61
62public Q_SLOTS:
63 void updateChartSettings();
64 void updateSerieSettings();
65 void updateSliceSettings();
66 void handleSliceClicked(QPieSlice *slice);
67 void showFontDialog();
68 void appendSlice();
69 void insertSlice();
70 void removeSlice();
71
72private:
73 QComboBox *m_themeComboBox;
74 QCheckBox *m_aaCheckBox;
75 QCheckBox *m_animationsCheckBox;
76 QCheckBox *m_legendCheckBox;
77
78 QChartView *m_chartView;
79 QPieSeries *m_series;
80 CustomSlice *m_slice;
81
82 QDoubleSpinBox *m_hPosition;
83 QDoubleSpinBox *m_vPosition;
84 QDoubleSpinBox *m_sizeFactor;
85 QDoubleSpinBox *m_startAngle;
86 QDoubleSpinBox *m_endAngle;
87 QDoubleSpinBox *m_holeSize;
88
89 QLineEdit *m_sliceName;
90 QDoubleSpinBox *m_sliceValue;
91 QCheckBox *m_sliceLabelVisible;
92 QDoubleSpinBox *m_sliceLabelArmFactor;
93 QCheckBox *m_sliceExploded;
94 QDoubleSpinBox *m_sliceExplodedFactor;
95 QPushButton *m_brush;
96 BrushTool *m_brushTool;
97 QPushButton *m_pen;
98 PenTool *m_penTool;
99 QPushButton *m_font;
100 QPushButton *m_labelBrush;
101 QComboBox *m_labelPosition;
102 BrushTool *m_labelBrushTool;
103};
104
105#endif // MAINWIDGET_H
106

source code of qtcharts/examples/charts/piechartcustomization/mainwidget.h