File tree Expand file tree Collapse file tree 7 files changed +91
-1
lines changed Expand file tree Collapse file tree 7 files changed +91
-1
lines changed Original file line number Diff line number Diff line change
1
+ # -------------------------------------------------
2
+ #
3
+ # Copyright (C) 2003-2103 CamelSoft Corporation
4
+ #
5
+ # -------------------------------------------------
6
+
7
+ QT += qml quick widgets charts
8
+
9
+ CONFIG += c++11
10
+
11
+ SOURCES += main.cpp
12
+
13
+ RESOURCES += qml.qrc
Original file line number Diff line number Diff line change
1
+ /* !
2
+ *@file main.cpp
3
+ *@brief 程序主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ #include < QApplication>
9
+ #include < QQmlApplicationEngine>
10
+
11
+ int main (int argc, char *argv[])
12
+ {
13
+ QApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
14
+ QApplication app (argc, argv);
15
+ QQmlApplicationEngine engine;
16
+ engine.load (QUrl (QStringLiteral (" qrc:/main.qml" )));
17
+ return app.exec ();
18
+ }
Original file line number Diff line number Diff line change
1
+ /*!
2
+ *@file main.qml
3
+ *@brief 主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ import QtQuick 2.7
9
+ import QtQuick.Controls 2.0
10
+ import QtCharts 2.2
11
+
12
+ ApplicationWindow {
13
+ visible: true
14
+ width: 400
15
+ height: 300
16
+ title: qsTr (" Qml饼状图" )
17
+
18
+ ChartView {
19
+ anchors .fill : parent
20
+ theme: ChartView .ChartThemeQt
21
+ antialiasing: true
22
+ legend .visible : false
23
+ animationOptions: ChartView .AllAnimations
24
+
25
+ PieSeries {
26
+ id: pieSeries
27
+ PieSlice {
28
+ borderColor: " #AAAAAA"
29
+ color: " #804040"
30
+ label: qsTr (" 整形" )
31
+ labelVisible: true
32
+ value: 66.6
33
+ }
34
+ PieSlice {
35
+ borderColor: " #AAAAAA"
36
+ color: " #408040"
37
+ label: qsTr (" 字符串" )
38
+ labelVisible: true
39
+ value: 30
40
+ }
41
+ PieSlice {
42
+ borderColor: " #AAAAAA"
43
+ color: " #404080"
44
+ label: qsTr (" 文件" )
45
+ labelVisible: true
46
+ value: 3.4
47
+ }
48
+ }
49
+ }
50
+ }
Original file line number Diff line number Diff line change
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>main.qml</file>
4
+ </qresource>
5
+ </RCC>
Original file line number Diff line number Diff line change @@ -47,4 +47,4 @@ SUBDIRS += QmlCanvasWaveProgress
47
47
SUBDIRS += QmlColorDialog
48
48
SUBDIRS += QmlFileDialog
49
49
SUBDIRS += QmlFontDialog
50
-
50
+ SUBDIRS += QmlChartView
Original file line number Diff line number Diff line change @@ -222,6 +222,10 @@ QmlFontDialog: Qml字体选择对话框
222
222
![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlFontDialog/show.gif?raw=true )
223
223
224
224
225
+ QmlChartView: Qml饼状图
226
+
227
+ ![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlChartView/show.gif?raw=true )
228
+
225
229
226
230
227
231
You can’t perform that action at this time.
0 commit comments