diff --git a/QWidgetDemo.pro b/QWidgetDemo.pro index ab8012d..c016308 100644 --- a/QWidgetDemo.pro +++ b/QWidgetDemo.pro @@ -59,3 +59,8 @@ SUBDIRS += designer #QtDesigner4源码 lessThan(QT_MAJOR_VERSION, 6) { SUBDIRS += qwtdemo #qwt的源码版本,无需插件,直接源码集成到你的项目即可 } + +#6.0到6.2之间的版本还有点问题等待正式发布的时候再试试 +greaterThan(QT_MAJOR_VERSION, 5) { +SUBDIRS -= emailtool +} diff --git a/QWidgetDemo.pro.user b/QWidgetDemo.pro.user deleted file mode 100644 index 513e404..0000000 --- a/QWidgetDemo.pro.user +++ /dev/null @@ -1,2964 +0,0 @@ - - - - - - EnvironmentId - {849db446-6f90-46aa-afcf-9e726de1fb02} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 0 - true - true - true - *.md, *.MD, Makefile - false - true - - - - ProjectExplorer.Project.PluginSettings - - - true - true - true - true - true - - - 0 - true - - - - ProjectExplorer.Project.Target.0 - - Desktop - desk5.7.0 - desk5.7.0 - {30975ac4-3883-489b-ac7a-132064e40ec0} - 0 - 0 - 0 - - 0 - I:\gitee\build-QWidgetDemo-desk5_7_0-Debug - I:/gitee/build-QWidgetDemo-desk5_7_0-Debug - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - 0 - - - I:\gitee\build-QWidgetDemo-desk5_7_0-Release - I:/gitee/build-QWidgetDemo-desk5_7_0-Release - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - I:\gitee\build-QWidgetDemo-desk5_7_0-Profile - I:/gitee/build-QWidgetDemo-desk5_7_0-Profile - - - true - QtProjectManager.QMakeBuildStep - - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/base64helper/base64helper.pro - I:/gitee/QWidgetDemo/base64helper/base64helper.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/base64helper/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/battery/battery.pro - I:/gitee/QWidgetDemo/battery/battery.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/battery/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ffmpegdemo/ffmpegdemo.pro - I:/gitee/QWidgetDemo/ffmpegdemo/ffmpegdemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/ffmpegdemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/flatui/flatui.pro - I:/gitee/QWidgetDemo/flatui/flatui.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/flatui/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/framelesswidget/framelesswidget.pro - I:/gitee/QWidgetDemo/framelesswidget/framelesswidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/framelesswidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/gifwidget/gifwidget.pro - I:/gitee/QWidgetDemo/gifwidget/gifwidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/gifwidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/imageswitch/imageswitch.pro - I:/gitee/QWidgetDemo/imageswitch/imageswitch.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/imageswitch/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ipaddress/ipaddress.pro - I:/gitee/QWidgetDemo/ipaddress/ipaddress.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/ipaddress/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lightbutton/lightbutton.pro - I:/gitee/QWidgetDemo/lightbutton/lightbutton.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/lightbutton/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lineeditnext/lineeditnext.pro - I:/gitee/QWidgetDemo/lineeditnext/lineeditnext.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/lineeditnext/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/lunarcalendarwidget/lunarcalendarwidget.pro - I:/gitee/QWidgetDemo/lunarcalendarwidget/lunarcalendarwidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/lunarcalendarwidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/maskwidget/maskwidget.pro - I:/gitee/QWidgetDemo/maskwidget/maskwidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/maskwidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/bgdemo/bgdemo.pro - I:/gitee/QWidgetDemo/bgdemo/bgdemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/bgdemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/miniblink/miniblink.pro - I:/gitee/QWidgetDemo/miniblink/miniblink.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/miniblink/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/mouseline/mouseline.pro - I:/gitee/QWidgetDemo/mouseline/mouseline.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/mouseline/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/movewidget/movewidget.pro - I:/gitee/QWidgetDemo/movewidget/movewidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/movewidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/mpvdemo/mpvdemo.pro - I:/gitee/QWidgetDemo/mpvdemo/mpvdemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/mpvdemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/navbutton/navbutton.pro - I:/gitee/QWidgetDemo/navbutton/navbutton.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/navbutton/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/netserver/netserver.pro - I:/gitee/QWidgetDemo/netserver/netserver.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/core_qui/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/nettool/nettool.pro - I:/gitee/QWidgetDemo/nettool/nettool.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/core_qui/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/ntpclient/ntpclient.pro - I:/gitee/QWidgetDemo/ntpclient/ntpclient.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/ntpclient/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/pngtool/pngtool.pro - I:/gitee/QWidgetDemo/pngtool/pngtool.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/pngtool/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/qwtdemo/qwtdemo.pro - I:/gitee/QWidgetDemo/qwtdemo/qwtdemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/qwtdemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/colorwidget/colorwidget.pro - I:/gitee/QWidgetDemo/colorwidget/colorwidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/colorwidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/savelog/savelog.pro - I:/gitee/QWidgetDemo/savelog/savelog.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/savelog/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/saveruntime/saveruntime.pro - I:/gitee/QWidgetDemo/saveruntime/saveruntime.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/saveruntime/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/screenwidget/screenwidget.pro - I:/gitee/QWidgetDemo/screenwidget/screenwidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/screenwidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/smoothcurve/smoothcurve.pro - I:/gitee/QWidgetDemo/smoothcurve/smoothcurve.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/smoothcurve/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/styledemo/styledemo.pro - I:/gitee/QWidgetDemo/styledemo/styledemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/styledemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/videopanel/videopanel.pro - I:/gitee/QWidgetDemo/videopanel/videopanel.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/videopanel/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/videowidget/videowidget.pro - I:/gitee/QWidgetDemo/videowidget/videowidget.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/videowidget/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/vlcdemo/vlcdemo.pro - I:/gitee/QWidgetDemo/vlcdemo/vlcdemo.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/vlcdemo/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/zhtopy/zhtopy.pro - I:/gitee/QWidgetDemo/zhtopy/zhtopy.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/zhtopy/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/comtool/comtool.pro - I:/gitee/QWidgetDemo/comtool/comtool.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/core_qui/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/countcode/countcode.pro - I:/gitee/QWidgetDemo/countcode/countcode.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/countcode/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/dbpage/dbpage.pro - I:/gitee/QWidgetDemo/dbpage/dbpage.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/dbpage/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/devicebutton/devicebutton.pro - I:/gitee/QWidgetDemo/devicebutton/devicebutton.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/devicebutton/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/devicesizetable/devicesizetable.pro - I:/gitee/QWidgetDemo/devicesizetable/devicesizetable.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/devicesizetable/../bin - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/emailtool/emailtool.pro - I:/gitee/QWidgetDemo/emailtool/emailtool.pro - false - true - true - false - true - I:/gitee/QWidgetDemo/emailtool/../bin - - 39 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/colorwidget/frmcolorwidget.ui b/colorwidget/frmcolorwidget.ui index bb01454..cc237ab 100644 --- a/colorwidget/frmcolorwidget.ui +++ b/colorwidget/frmcolorwidget.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600 diff --git a/core_qui/iconhelper.h b/core_qui/iconhelper.h index d0cb977..48e4251 100644 --- a/core_qui/iconhelper.h +++ b/core_qui/iconhelper.h @@ -8,11 +8,18 @@ /** * 超级图形字体类 作者:feiyangqingyun(QQ:517216493) 2016-11-23 - * 1. 可传入多种图形字体文件。 - * 2. 可设置 QLabel+QAbstractButton 图形字体。 - * 3. 可设置按钮图标。 - * 4. 可获取指定尺寸的图形字体图片。 - * 5. 超级导航栏样式设置,带图标和效果切换、悬停颜色、按下颜色、选中颜色。 + * 1. 可传入多种图形字体文件,一个类通用所有图形字体。 + * 2. 默认已经内置了阿里巴巴图形字体FontAliBaBa、国际知名图形字体FontAwesome、天气图形字体FontWeather。 + * 3. 可设置 QLabel、QAbstractButton 文本为图形字体。 + * 4. 可设置图形字体作为 QAbstractButton 按钮图标。 + * 5. 内置万能的方法 getPixmap 将图形字体值转换为图片。 + * 6. 无论是设置文本、图标、图片等都可以设置图标的大小、尺寸、颜色等参数。 + * 7. 内置超级导航栏样式设置,将图形字体作为图标设置到按钮。 + * 8. 支持各种颜色设置比如正常颜色、悬停颜色、按下颜色、选中颜色。 + * 9. 可设置导航的位置为 left、right、top、bottom 四种。 + * 10. 可设置导航加深边框颜色和粗细大小。 + * 11. 导航面板的各种切换效果比如鼠标悬停、按下、选中等都自动处理掉样式设置。 + * 12. 全局静态方法,接口丰富,使用极其简单方便。 */ #ifdef quc diff --git a/framelesswidget/framelesscore/framelessmainwindow.h b/framelesswidget/framelesscore/framelessmainwindow.h index 15cf36f..46d7f72 100644 --- a/framelesswidget/framelesscore/framelessmainwindow.h +++ b/framelesswidget/framelesscore/framelessmainwindow.h @@ -61,7 +61,7 @@ private: //存储窗体默认的属性 Qt::WindowFlags flags; -public: +public slots: //设置边距+可拖动+可拉伸 void setPadding(int padding); void setMoveEnable(bool moveEnable); diff --git a/gifwidget/frmgifwidget.ui b/gifwidget/frmgifwidget.ui index 3b93ae6..a43fbae 100644 --- a/gifwidget/frmgifwidget.ui +++ b/gifwidget/frmgifwidget.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600 diff --git a/ipaddress/frmipaddress.cpp b/ipaddress/frmipaddress.cpp index dc72048..283cb52 100644 --- a/ipaddress/frmipaddress.cpp +++ b/ipaddress/frmipaddress.cpp @@ -7,6 +7,7 @@ frmIPAddress::frmIPAddress(QWidget *parent) : QWidget(parent), ui(new Ui::frmIPAddress) { ui->setupUi(this); + on_btnSetIP_clicked(); } frmIPAddress::~frmIPAddress() diff --git a/ipaddress/frmipaddress.ui b/ipaddress/frmipaddress.ui index 1d32a4a..90a001c 100644 --- a/ipaddress/frmipaddress.ui +++ b/ipaddress/frmipaddress.ui @@ -6,19 +6,19 @@ 0 0 - 500 - 300 + 800 + 600 Form - + - 9 - 9 - 481 + 10 + 10 + 281 71 @@ -29,7 +29,7 @@ - 设置IP + 填入IP diff --git a/ipaddress/main.cpp b/ipaddress/main.cpp index 2a49bb4..88244de 100644 --- a/ipaddress/main.cpp +++ b/ipaddress/main.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); a.setFont(QFont("Microsoft Yahei", 9)); -#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0)) +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) #if _MSC_VER QTextCodec *codec = QTextCodec::codecForName("gbk"); #else diff --git a/maskwidget/frmmaskwidget.cpp b/maskwidget/frmmaskwidget.cpp index 1893132..e2109ac 100644 --- a/maskwidget/frmmaskwidget.cpp +++ b/maskwidget/frmmaskwidget.cpp @@ -16,7 +16,6 @@ frmMaskWidget::frmMaskWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmM frmMaskWidget::~frmMaskWidget() { delete ui; - exit(0); } void frmMaskWidget::initForm() diff --git a/maskwidget/frmmaskwidget.ui b/maskwidget/frmmaskwidget.ui index a7a1923..5495ae4 100644 --- a/maskwidget/frmmaskwidget.ui +++ b/maskwidget/frmmaskwidget.ui @@ -6,8 +6,8 @@ 0 0 - 600 - 480 + 800 + 600 diff --git a/movewidget/frmmovewidget.ui b/movewidget/frmmovewidget.ui index 86ddc45..bc9265e 100644 --- a/movewidget/frmmovewidget.ui +++ b/movewidget/frmmovewidget.ui @@ -6,8 +6,8 @@ 0 0 - 500 - 300 + 800 + 600 diff --git a/navbutton/frmnavbutton.cpp b/navbutton/frmnavbutton.cpp index cfaf14d..3dba9a6 100644 --- a/navbutton/frmnavbutton.cpp +++ b/navbutton/frmnavbutton.cpp @@ -10,6 +10,13 @@ frmNavButton::frmNavButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmNav { ui->setupUi(this); this->initForm(); + this->initBtn1(); + this->initBtn2(); + this->initBtn3(); + this->initBtn4(); + this->initBtn5(); + this->initBtn6(); + this->initBtn7(); } frmNavButton::~frmNavButton() @@ -18,6 +25,22 @@ frmNavButton::~frmNavButton() } void frmNavButton::initForm() +{ + icons << 0xf17b << 0xf002 << 0xf013 << 0xf021 << 0xf0e0 << 0xf135; + + ui->navButton11->setChecked(true); + ui->navButton23->setChecked(true); + ui->navButton31->setChecked(true); + ui->navButton44->setChecked(true); + ui->navButton53->setChecked(true); + ui->navButton61->setChecked(true); + ui->navButton75->setChecked(true); + + //设置整体圆角 + ui->widgetNav5->setStyleSheet(".QWidget{background:#292929;border:1px solid #292929;border-radius:20px;}"); +} + +void frmNavButton::initBtn1() { quint32 size = 15; quint32 pixWidth = 15; @@ -44,13 +67,14 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick1())); } +} - size = 15; - pixWidth = 20; - pixHeight = 20; +void frmNavButton::initBtn2() +{ + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; - QList icons; - icons << 0xf17b << 0xf002 << 0xf013 << 0xf021 << 0xf0e0 << 0xf135; QColor normalBgColor = QColor("#2D9191"); QColor hoverBgColor = QColor("#187294"); QColor checkBgColor = QColor("#145C75"); @@ -90,13 +114,20 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick2())); } +} - normalBgColor = QColor("#292F38"); - hoverBgColor = QColor("#1D2025"); - checkBgColor = QColor("#1D2025"); - normalTextColor = QColor("#54626F"); - hoverTextColor = QColor("#FDFDFD"); - checkTextColor = QColor("#FDFDFD"); +void frmNavButton::initBtn3() +{ + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#292F38"); + QColor hoverBgColor = QColor("#1D2025"); + QColor checkBgColor = QColor("#1D2025"); + QColor normalTextColor = QColor("#54626F"); + QColor hoverTextColor = QColor("#FDFDFD"); + QColor checkTextColor = QColor("#FDFDFD"); btns3 << ui->navButton31 << ui->navButton32 << ui->navButton33 << ui->navButton34; for (int i = 0; i < btns3.count(); i++) { @@ -132,15 +163,18 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick3())); } +} - size = 15; - pixWidth = 15; - pixHeight = 15; +void frmNavButton::initBtn4() +{ + quint32 size = 15; + quint32 pixWidth = 15; + quint32 pixHeight = 15; - icon = 0xf105; - iconNormal = IconHelper::getPixmap(QColor(100, 100, 100).name(), icon, size, pixWidth, pixHeight); - iconHover = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); - iconCheck = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + int icon = 0xf105; + QPixmap iconNormal = IconHelper::getPixmap(QColor(100, 100, 100).name(), icon, size, pixWidth, pixHeight); + QPixmap iconHover = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); + QPixmap iconCheck = IconHelper::getPixmap(QColor(255, 255, 255).name(), icon, size, pixWidth, pixHeight); btns4 << ui->navButton41 << ui->navButton42 << ui->navButton43 << ui->navButton44; for (int i = 0; i < btns4.count(); i++) { @@ -154,7 +188,7 @@ void frmNavButton::initForm() btn->setLinePosition(NavButton::LinePosition_Right); btn->setShowIcon(true); - btn->setIconSpace(25); + btn->setIconSpace(10); btn->setIconSize(QSize(15, 15)); btn->setIconNormal(iconNormal); btn->setIconHover(iconHover); @@ -162,21 +196,24 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick4())); } +} - size = 15; - pixWidth = 20; - pixHeight = 20; - +void frmNavButton::initBtn5() +{ QFont font; font.setPixelSize(15); font.setBold(true); - normalBgColor = QColor("#292929"); - hoverBgColor = QColor("#064077"); - checkBgColor = QColor("#10689A"); - normalTextColor = QColor("#FFFFFF"); - hoverTextColor = Qt::yellow; - checkTextColor = QColor("#FFFFFF"); + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#292929"); + QColor hoverBgColor = QColor("#064077"); + QColor checkBgColor = QColor("#10689A"); + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = Qt::yellow; + QColor checkTextColor = QColor("#FFFFFF"); btns5 << ui->navButton51 << ui->navButton52 << ui->navButton53 << ui->navButton54 << ui->navButton55; for (int i = 0; i < btns5.count(); i++) { @@ -210,13 +247,24 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick5())); } +} - normalBgColor = QColor("#E6393D"); - hoverBgColor = QColor("#EE0000"); - checkBgColor = QColor("#A40001"); - normalTextColor = QColor("#FFFFFF"); - hoverTextColor = QColor("#FFFFFF"); - checkTextColor = QColor("#FFFFFF"); +void frmNavButton::initBtn6() +{ + QFont font; + font.setPixelSize(15); + font.setBold(true); + + quint32 size = 15; + quint32 pixWidth = 20; + quint32 pixHeight = 20; + + QColor normalBgColor = QColor("#E6393D"); + QColor hoverBgColor = QColor("#EE0000"); + QColor checkBgColor = QColor("#A40001"); + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = QColor("#FFFFFF"); + QColor checkTextColor = QColor("#FFFFFF"); btns6 << ui->navButton61 << ui->navButton62 << ui->navButton63 << ui->navButton64 << ui->navButton65; for (int i = 0; i < btns6.count(); i++) { @@ -250,14 +298,25 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick6())); } +} + +void frmNavButton::initBtn7() +{ + QFont font; + font.setPixelSize(15); + font.setBold(true); + + QColor normalTextColor = QColor("#FFFFFF"); + QColor hoverTextColor = QColor("#FFFFFF"); + QColor checkTextColor = QColor("#FFFFFF"); //设置背景色为画刷 - QLinearGradient normalBgBrush(0, 0, 0, ui->navButton61->height()); + QLinearGradient normalBgBrush(0, 0, 0, ui->navButton71->height()); normalBgBrush.setColorAt(0.0, QColor("#3985BF")); normalBgBrush.setColorAt(0.5, QColor("#2972A9")); normalBgBrush.setColorAt(1.0, QColor("#1C6496")); - QLinearGradient hoverBgBrush(0, 0, 0, ui->navButton61->height()); + QLinearGradient hoverBgBrush(0, 0, 0, ui->navButton71->height()); hoverBgBrush.setColorAt(0.0, QColor("#4897D1")); hoverBgBrush.setColorAt(0.5, QColor("#3283BC")); hoverBgBrush.setColorAt(1.0, QColor("#3088C3")); @@ -283,17 +342,6 @@ void frmNavButton::initForm() connect(btn, SIGNAL(clicked(bool)), this, SLOT(buttonClick7())); } - - ui->navButton11->setChecked(true); - ui->navButton23->setChecked(true); - ui->navButton31->setChecked(true); - ui->navButton44->setChecked(true); - ui->navButton53->setChecked(true); - ui->navButton61->setChecked(true); - ui->navButton75->setChecked(true); - - //设置整体圆角 - ui->widgetNav5->setStyleSheet(".QWidget{background:#292929;border:1px solid #292929;border-radius:20px;}"); } void frmNavButton::buttonClick1() diff --git a/navbutton/frmnavbutton.h b/navbutton/frmnavbutton.h index 427aa8f..2a4c62d 100644 --- a/navbutton/frmnavbutton.h +++ b/navbutton/frmnavbutton.h @@ -19,6 +19,7 @@ public: private: Ui::frmNavButton *ui; + QList icons; QList btns1; QList btns2; QList btns3; @@ -29,6 +30,14 @@ private: private slots: void initForm(); + void initBtn1(); + void initBtn2(); + void initBtn3(); + void initBtn4(); + void initBtn5(); + void initBtn6(); + void initBtn7(); + void buttonClick1(); void buttonClick2(); void buttonClick3(); diff --git a/navbutton/frmnavbutton.ui b/navbutton/frmnavbutton.ui index 4e786d7..569c593 100644 --- a/navbutton/frmnavbutton.ui +++ b/navbutton/frmnavbutton.ui @@ -6,534 +6,549 @@ 0 0 - 500 - 300 + 800 + 605 - - - 500 - 0 - - - - - 500 - 16777215 - - Form - - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - - 0 + + + + 11 + 245 + 611 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - 0 + + 首页 - - 0 + + + + + + + 0 + 0 + - - 0 + + 论坛 - - 0 + + + + + + + 0 + 0 + - - - - - 0 - 0 - - - - 首页 - - - - - - - - 0 - 0 - - - - 论坛 - - - - - - - - 0 - 0 - - - - Qt下载 - - - - - - - - 0 - 0 - - - - 作品展 - - - - - - - - 0 - 0 - - - - 群组 - - - - - - - - 0 - 0 - - - - 个人中心 - - - - - - - - - - - 0 + + Qt下载 - - 0 + + + + + + + 0 + 0 + - - 0 + + 作品展 - - 0 + + + + + + + 0 + 0 + - - - - 学生管理 - - - - - - - 教师管理 - - - - - - - 成绩管理 - - - - - - - 记录查询 - - - - - - - - - - - 0 + + 群组 - - 0 + + + + + + + 0 + 0 + - - 0 + + 个人中心 - - 0 + + + + + + + + 11 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 - - - - 访客登记 - - - - - - - 记录查询 - - - - - - - 系统设置 - - - - - - - 系统重启 - - - - - - - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - - 0 + + + + + + 教师管理 - - 0 + + + + + + 成绩管理 - - 0 + + + + + + 记录查询 - - 0 + + + + + + + + 140 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 访客登记 - - 0 + + + + + + 记录查询 - - - - - 0 - 0 - - - - 首页 - - - - - - - - 0 - 0 - - - - 论坛 - - - - - - - - 0 - 0 - - - - 作品 - - - - - - - - 0 - 0 - - - - 群组 - - - - - - - - 0 - 0 - - - - 帮助 - - - - - - - - - - - 0 - 40 - - - - - 16777215 - 40 - - - - - 0 + + + + + + 系统设置 - - 0 + + + + + + 系统重启 - - 0 + + + + + + + + 11 + 151 + 511 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - 0 + + 首页 - - 0 + + + + + + + 0 + 0 + - - - - - 0 - 0 - - - - 首页 - - - - - - - - 0 - 0 - - - - 论坛 - - - - - - - - 0 - 0 - - - - 作品 - - - - - - - - 0 - 0 - - - - 群组 - - - - - - - - 0 - 0 - - - - 帮助 - - - - - - - - - - - 6 + + 论坛 - - 0 + + + + + + + 0 + 0 + - - 0 + + 作品 - - 0 + + + + + + + 0 + 0 + - - 0 + + 群组 - - - - 学生管理 - - - - - - - 教师管理 - - - - - - - 成绩管理 - - - - - - - 记录查询 - - - - - - - - - - - 0 + + + + + + + 0 + 0 + - - 0 + + 帮助 - - 0 + + + + + + + + 11 + 198 + 511 + 40 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + - - 0 + + 首页 - - - - 学生管理 - - - - - - - 教师管理 - - - - - - - 成绩管理 - - - - - - - 记录查询 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + + + + + 0 + 0 + + + + 论坛 + + + + + + + + 0 + 0 + + + + 作品 + + + + + + + + 0 + 0 + + + + 群组 + + + + + + + + 0 + 0 + + + + 帮助 + + + + + + + + + 270 + 11 + 120 + 133 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 + + + + + + + 教师管理 + + + + + + + 成绩管理 + + + + + + + 记录查询 + + + + + + + + + 400 + 11 + 120 + 133 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 学生管理 + + + + + + + 教师管理 + + + + + + + 成绩管理 + + + + + + + 记录查询 + + + + + diff --git a/navbutton/iconhelper.cpp b/navbutton/iconhelper.cpp index e9df4ff..2043d36 100644 --- a/navbutton/iconhelper.cpp +++ b/navbutton/iconhelper.cpp @@ -2,6 +2,9 @@ IconHelper *IconHelper::iconFontAliBaBa = 0; IconHelper *IconHelper::iconFontAwesome = 0; +IconHelper *IconHelper::iconFontWeather = 0; +int IconHelper::iconFontIndex = -1; + void IconHelper::initFont() { static bool isInit = false; @@ -13,103 +16,101 @@ void IconHelper::initFont() if (iconFontAwesome == 0) { iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome"); } + if (iconFontWeather == 0) { + iconFontWeather = new IconHelper(":/image/pe-icon-set-weather.ttf", "pe-icon-set-weather"); + } } } +QFont IconHelper::getIconFontAliBaBa() +{ + initFont(); + return iconFontAliBaBa->getIconFont(); +} + +QFont IconHelper::getIconFontAwesome() +{ + initFont(); + return iconFontAwesome->getIconFont(); +} + +QFont IconHelper::getIconFontWeather() +{ + initFont(); + return iconFontWeather->getIconFont(); +} + +IconHelper *IconHelper::getIconHelper(int icon) +{ + initFont(); + + //指定了字体索引则取对应索引的字体类 + //没指定则自动根据不同的字体的值选择对应的类 + //由于部分值范围冲突所以可以指定索引来取 + //fontawesome 0xf000-0xf2e0 + //iconfont 0xe501-0xe793 0xe8d5-0xea5d + //weather 0xe900-0xe9cf + + IconHelper *iconHelper = iconFontAwesome; + if (iconFontIndex < 0) { + if ((icon > 0xe501 && icon < 0xe793) || (icon > 0xe8d5 && icon < 0xea5d)) { + iconHelper = iconFontAliBaBa; + } + } else if (iconFontIndex == 0) { + iconHelper = iconFontAliBaBa; + } else if (iconFontIndex == 1) { + iconHelper = iconFontAwesome; + } else if (iconFontIndex == 2) { + iconHelper = iconFontWeather; + } + + return iconHelper; +} + void IconHelper::setIcon(QLabel *lab, int icon, quint32 size) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setIcon1(lab, icon, size); - } else if (icon > 0xf000) { - iconFontAwesome->setIcon1(lab, icon, size); - } + getIconHelper(icon)->setIcon1(lab, icon, size); } void IconHelper::setIcon(QAbstractButton *btn, int icon, quint32 size) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setIcon1(btn, icon, size); - } else if (icon > 0xf000) { - iconFontAwesome->setIcon1(btn, icon, size); - } + getIconHelper(icon)->setIcon1(btn, icon, size); } void IconHelper::setPixmap(QAbstractButton *btn, const QColor &color, int icon, quint32 size, quint32 width, quint32 height, int flags) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setPixmap1(btn, color, icon, size, width, height, flags); - } else if (icon > 0xf000) { - iconFontAwesome->setPixmap1(btn, color, icon, size, width, height, flags); - } + getIconHelper(icon)->setPixmap1(btn, color, icon, size, width, height, flags); } QPixmap IconHelper::getPixmap(const QColor &color, int icon, quint32 size, quint32 width, quint32 height, int flags) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 - QPixmap pix; - if (icon > 0xe000 && icon < 0xf000) { - pix = iconFontAliBaBa->getPixmap1(color, icon, size, width, height, flags); - } else if (icon > 0xf000) { - pix = iconFontAwesome->getPixmap1(color, icon, size, width, height, flags); - } - return pix; + return getIconHelper(icon)->getPixmap1(color, icon, size, width, height, flags); } void IconHelper::setStyle(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 int icon = icons.first(); - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor); - } else if (icon > 0xf000) { - iconFontAwesome->setStyle1(widget, btns, icons, styleColor); - } + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); } void IconHelper::setStyle(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 int icon = icons.first(); - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor); - } else if (icon > 0xf000) { - iconFontAwesome->setStyle1(widget, btns, icons, styleColor); - } + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); } void IconHelper::setStyle(QWidget *widget, QList btns, QList icons, const IconHelper::StyleColor &styleColor) { - initFont(); - - //自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头 int icon = icons.first(); - if (icon > 0xe000 && icon < 0xf000) { - iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor); - } else if (icon > 0xf000) { - iconFontAwesome->setStyle1(widget, btns, icons, styleColor); - } + getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor); } + IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject *parent) : QObject(parent) { //判断图形字体是否存在,不存在则加入 @@ -122,6 +123,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject } } + //再次判断是否包含字体名称防止加载失败 if (fontDb.families().contains(fontName)) { iconFont = QFont(fontName); #if (QT_VERSION >= QT_VERSION_CHECK(4,8,0)) @@ -179,6 +181,11 @@ void IconHelper::toggled(bool checked) } } +QFont IconHelper::getIconFont() +{ + return this->iconFont; +} + void IconHelper::setIcon1(QLabel *lab, int icon, quint32 size) { iconFont.setPixelSize(size); @@ -269,8 +276,9 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList } //如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色 + //如果图标在文字上面而设置的边框是 top bottom 也需要启用加深边框 QStringList qss; - if (styleColor.textBesideIcon) { + if (styleColor.defaultBorder) { qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}") .arg(position).arg(strBorder).arg(styleColor.normalBgColor).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor); } else { diff --git a/navbutton/iconhelper.h b/navbutton/iconhelper.h index ad5ea9a..48e4251 100644 --- a/navbutton/iconhelper.h +++ b/navbutton/iconhelper.h @@ -8,11 +8,18 @@ /** * 超级图形字体类 作者:feiyangqingyun(QQ:517216493) 2016-11-23 - * 1. 可传入多种图形字体文件。 - * 2. 可设置 QLabel+QAbstractButton 图形字体。 - * 3. 可设置按钮图标。 - * 4. 可获取指定尺寸的图形字体图片。 - * 5. 超级导航栏样式设置,带图标和效果切换、悬停颜色、按下颜色、选中颜色。 + * 1. 可传入多种图形字体文件,一个类通用所有图形字体。 + * 2. 默认已经内置了阿里巴巴图形字体FontAliBaBa、国际知名图形字体FontAwesome、天气图形字体FontWeather。 + * 3. 可设置 QLabel、QAbstractButton 文本为图形字体。 + * 4. 可设置图形字体作为 QAbstractButton 按钮图标。 + * 5. 内置万能的方法 getPixmap 将图形字体值转换为图片。 + * 6. 无论是设置文本、图标、图片等都可以设置图标的大小、尺寸、颜色等参数。 + * 7. 内置超级导航栏样式设置,将图形字体作为图标设置到按钮。 + * 8. 支持各种颜色设置比如正常颜色、悬停颜色、按下颜色、选中颜色。 + * 9. 可设置导航的位置为 left、right、top、bottom 四种。 + * 10. 可设置导航加深边框颜色和粗细大小。 + * 11. 导航面板的各种切换效果比如鼠标悬停、按下、选中等都自动处理掉样式设置。 + * 12. 全局静态方法,接口丰富,使用极其简单方便。 */ #ifdef quc @@ -28,7 +35,7 @@ public: //样式颜色结构体 struct StyleColor { QString position; //位置 left right top bottom - bool textBesideIcon; //文字在图标左侧 + bool defaultBorder; //默认有边框 quint32 iconSize; //图标字体尺寸 quint32 iconWidth; //图标图片宽度 @@ -48,7 +55,7 @@ public: StyleColor() { position = "left"; - textBesideIcon = false; + defaultBorder = false; iconSize = 12; iconWidth = 15; @@ -87,20 +94,38 @@ public: static IconHelper *iconFontAliBaBa; //FontAwesome图形字体类 static IconHelper *iconFontAwesome; + //天气图形字体类 + static IconHelper *iconFontWeather; + //图形字体索引 + static int iconFontIndex; + //初始化图形字体 static void initFont(); + //获取图形字体 + static QFont getIconFontAliBaBa(); + static QFont getIconFontAwesome(); + static QFont getIconFontWeather(); + + //根据值获取图形字体类 + static IconHelper *getIconHelper(int icon); + + //设置图形字体到标签 static void setIcon(QLabel *lab, int icon, quint32 size = 12); + //设置图形字体到按钮 static void setIcon(QAbstractButton *btn, int icon, quint32 size = 12); + //设置图形字体到图标 static void setPixmap(QAbstractButton *btn, const QColor &color, int icon, quint32 size = 12, quint32 width = 15, quint32 height = 15, int flags = Qt::AlignCenter); + //获取指定图形字体,可以指定文字大小,图片宽高,文字对齐 static QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12, quint32 width = 15, quint32 height = 15, int flags = Qt::AlignCenter); + //指定导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色 static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); static void setStyle(QWidget *widget, QList btns, QList icons, const StyleColor &styleColor); @@ -124,6 +149,9 @@ private slots: void toggled(bool checked); public: + //获取图形字体 + QFont getIconFont(); + //设置图形字体到标签 void setIcon1(QLabel *lab, int icon, quint32 size = 12); //设置图形字体到按钮 diff --git a/ntpclient/frmntpclient.cpp b/ntpclient/frmntpclient.cpp index d737862..1b1da6e 100644 --- a/ntpclient/frmntpclient.cpp +++ b/ntpclient/frmntpclient.cpp @@ -3,6 +3,7 @@ #include "frmntpclient.h" #include "ui_frmntpclient.h" #include "ntpclient.h" +#include "qdebug.h" frmNtpClient::frmNtpClient(QWidget *parent) : QWidget(parent), ui(new Ui::frmNtpClient) { diff --git a/ntpclient/frmntpclient.ui b/ntpclient/frmntpclient.ui index 0ca1bf9..569eb68 100644 --- a/ntpclient/frmntpclient.ui +++ b/ntpclient/frmntpclient.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600 diff --git a/ntpclient/main.cpp b/ntpclient/main.cpp index 1c6bfde..4a8811e 100644 --- a/ntpclient/main.cpp +++ b/ntpclient/main.cpp @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); a.setFont(QFont("Microsoft Yahei", 9)); -#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0)) +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) #if _MSC_VER QTextCodec *codec = QTextCodec::codecForName("gbk"); #else diff --git a/savelog/frmsavelog.h b/savelog/frmsavelog.h index c967803..6c5d21b 100644 --- a/savelog/frmsavelog.h +++ b/savelog/frmsavelog.h @@ -25,8 +25,7 @@ private slots: void on_btnDebug_clicked(); void on_ckTimer_stateChanged(int arg1); void on_ckNet_stateChanged(int arg1); - void on_ckSave_stateChanged(int arg1); - + void on_ckSave_stateChanged(int arg1); }; #endif // FRMSAVELOG_H diff --git a/savelog/frmsavelog.ui b/savelog/frmsavelog.ui index d8e6ec9..318d243 100644 --- a/savelog/frmsavelog.ui +++ b/savelog/frmsavelog.ui @@ -6,50 +6,67 @@ 0 0 - 400 - 300 + 800 + 600 Form - - - - - 定时器打印消息 - - - - - - - 保存日志 - - - - - - - - 0 - 0 - - - - 手动插入消息 - - - - + + - - - - 重定向到网络 - - + + + + + + + 130 + 0 + + + + 手动插入消息 + + + + + + + 定时器打印消息 + + + + + + + 重定向到网络 + + + + + + + 保存日志 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + diff --git a/saveruntime/frmsaveruntime.cpp b/saveruntime/frmsaveruntime.cpp index 39e7469..0102adb 100644 --- a/saveruntime/frmsaveruntime.cpp +++ b/saveruntime/frmsaveruntime.cpp @@ -2,11 +2,12 @@ #include "frmsaveruntime.h" #include "ui_frmsaveruntime.h" +#include "qfile.h" #include "saveruntime.h" frmSaveRunTime::frmSaveRunTime(QWidget *parent) : QWidget(parent), ui(new Ui::frmSaveRunTime) { - ui->setupUi(this); + ui->setupUi(this); } frmSaveRunTime::~frmSaveRunTime() @@ -21,4 +22,27 @@ void frmSaveRunTime::on_checkBox_stateChanged(int arg1) } else { SaveRunTime::Instance()->start(); } + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnAppend_clicked() +{ + SaveRunTime::Instance()->initLog(); + SaveRunTime::Instance()->appendLog(); + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnUpdate_clicked() +{ + SaveRunTime::Instance()->saveLog(); + on_btnOpen_clicked(); +} + +void frmSaveRunTime::on_btnOpen_clicked() +{ + QString fileName = QString("%1/examples_runtime_%2.txt").arg(qApp->applicationDirPath()).arg(QDate::currentDate().year()); + QFile file(fileName); + if (file.open(QFile::ReadOnly | QFile::Text)) { + ui->txtMain->setText(file.readAll()); + } } diff --git a/saveruntime/frmsaveruntime.h b/saveruntime/frmsaveruntime.h index 88412aa..20df424 100644 --- a/saveruntime/frmsaveruntime.h +++ b/saveruntime/frmsaveruntime.h @@ -20,6 +20,9 @@ private: private slots: void on_checkBox_stateChanged(int arg1); + void on_btnAppend_clicked(); + void on_btnUpdate_clicked(); + void on_btnOpen_clicked(); }; #endif // FRMSAVERUNTIME_H diff --git a/saveruntime/frmsaveruntime.ui b/saveruntime/frmsaveruntime.ui index 30e999b..50d8173 100644 --- a/saveruntime/frmsaveruntime.ui +++ b/saveruntime/frmsaveruntime.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600 @@ -15,24 +15,70 @@ - - - Qt::Vertical - - - - 20 - 40 - - - + - - - 启动服务 - - + + + + + 启动服务 + + + + + + + + 130 + 0 + + + + 插入一条记录 + + + + + + + + 130 + 0 + + + + 更新一条记录 + + + + + + + + 130 + 0 + + + + 打开记录文件 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + diff --git a/screenwidget/frmscreenwidget.ui b/screenwidget/frmscreenwidget.ui index ba08e86..54a035a 100644 --- a/screenwidget/frmscreenwidget.ui +++ b/screenwidget/frmscreenwidget.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600 diff --git a/trayicon/frmtrayicon.cpp b/trayicon/frmtrayicon.cpp new file mode 100644 index 0000000..9357cd0 --- /dev/null +++ b/trayicon/frmtrayicon.cpp @@ -0,0 +1,27 @@ +#include "frmtrayicon.h" +#include "ui_frmtrayicon.h" +#include "trayicon.h" + +frmTrayIcon::frmTrayIcon(QWidget *parent) : QWidget(parent), ui(new Ui::frmTrayIcon) +{ + ui->setupUi(this); + TrayIcon::Instance()->setIcon(":/main.ico"); + TrayIcon::Instance()->setMainWidget(this); +} + +frmTrayIcon::~frmTrayIcon() +{ + TrayIcon::Instance()->setVisible(false); + delete ui; +} + +void frmTrayIcon::on_btnShow_clicked() +{ + TrayIcon::Instance()->setVisible(true); + TrayIcon::Instance()->showMessage("自定义控件大全", "已经最小化到托盘,双击打开!"); +} + +void frmTrayIcon::on_btnHide_clicked() +{ + TrayIcon::Instance()->setVisible(false); +} diff --git a/trayicon/frmtrayicon.h b/trayicon/frmtrayicon.h new file mode 100644 index 0000000..73a482c --- /dev/null +++ b/trayicon/frmtrayicon.h @@ -0,0 +1,26 @@ +#ifndef FRMTRAYICON_H +#define FRMTRAYICON_H + +#include + +namespace Ui { +class frmTrayIcon; +} + +class frmTrayIcon : public QWidget +{ + Q_OBJECT + +public: + explicit frmTrayIcon(QWidget *parent = 0); + ~frmTrayIcon(); + +private: + Ui::frmTrayIcon *ui; + +private slots: + void on_btnShow_clicked(); + void on_btnHide_clicked(); +}; + +#endif // FRMTRAYICON_H diff --git a/trayicon/frmtrayicon.ui b/trayicon/frmtrayicon.ui new file mode 100644 index 0000000..1265efc --- /dev/null +++ b/trayicon/frmtrayicon.ui @@ -0,0 +1,45 @@ + + + frmTrayIcon + + + + 0 + 0 + 800 + 600 + + + + Form + + + + + 10 + 10 + 92 + 28 + + + + 显示托盘 + + + + + + 10 + 50 + 92 + 28 + + + + 隐藏托盘 + + + + + + diff --git a/trayicon/main.cpp b/trayicon/main.cpp new file mode 100644 index 0000000..5470f2e --- /dev/null +++ b/trayicon/main.cpp @@ -0,0 +1,31 @@ +#pragma execution_character_set("utf-8") + +#include "frmtrayicon.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + a.setFont(QFont("Microsoft Yahei", 9)); + +#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) +#if _MSC_VER + QTextCodec *codec = QTextCodec::codecForName("gbk"); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); +#endif + QTextCodec::setCodecForLocale(codec); + QTextCodec::setCodecForCStrings(codec); + QTextCodec::setCodecForTr(codec); +#else + QTextCodec *codec = QTextCodec::codecForName("utf-8"); + QTextCodec::setCodecForLocale(codec); +#endif + + frmTrayIcon w; + w.setWindowTitle("托盘图标"); + w.show(); + + return a.exec(); +} diff --git a/trayicon/main.ico b/trayicon/main.ico new file mode 100644 index 0000000..34e1ca9 Binary files /dev/null and b/trayicon/main.ico differ diff --git a/trayicon/main.qrc b/trayicon/main.qrc new file mode 100644 index 0000000..91c2747 --- /dev/null +++ b/trayicon/main.qrc @@ -0,0 +1,5 @@ + + + main.ico + + diff --git a/trayicon/trayicon.cpp b/trayicon/trayicon.cpp new file mode 100644 index 0000000..98b5f49 --- /dev/null +++ b/trayicon/trayicon.cpp @@ -0,0 +1,98 @@ +#pragma execution_character_set("utf-8") + +#include "trayicon.h" +#include "qmutex.h" +#include "qmenu.h" +#include "qapplication.h" +#include "qdebug.h" + +QScopedPointer TrayIcon::self; +TrayIcon *TrayIcon::Instance() +{ + if (self.isNull()) { + static QMutex mutex; + QMutexLocker locker(&mutex); + if (self.isNull()) { + self.reset(new TrayIcon); + } + } + + return self.data(); +} + +TrayIcon::TrayIcon(QObject *parent) : QObject(parent) +{ + mainWidget = 0; + trayIcon = new QSystemTrayIcon(this); + connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason))); + menu = new QMenu; + exitDirect = true; +} + +void TrayIcon::iconIsActived(QSystemTrayIcon::ActivationReason reason) +{ + switch (reason) { + case QSystemTrayIcon::Trigger: + case QSystemTrayIcon::DoubleClick: { + mainWidget->showNormal(); + break; + } + + default: + break; + } +} + +bool TrayIcon::getVisible() const +{ + return trayIcon->isVisible(); +} + +void TrayIcon::setExitDirect(bool exitDirect) +{ + if (this->exitDirect != exitDirect) { + this->exitDirect = exitDirect; + } +} + +void TrayIcon::setMainWidget(QWidget *mainWidget) +{ + this->mainWidget = mainWidget; + menu->addAction("主界面", mainWidget, SLOT(showNormal())); + + if (exitDirect) { + menu->addAction("退出", this, SLOT(closeAll())); + } else { + menu->addAction("退出", this, SIGNAL(trayIconExit())); + } + + trayIcon->setContextMenu(menu); +} + +void TrayIcon::showMessage(const QString &title, const QString &msg, QSystemTrayIcon::MessageIcon icon, int msecs) +{ + trayIcon->showMessage(title, msg, icon, msecs); +} + +void TrayIcon::setIcon(const QString &strIcon) +{ + trayIcon->setIcon(QIcon(strIcon)); +} + +void TrayIcon::setToolTip(const QString &tip) +{ + trayIcon->setToolTip(tip); +} + +void TrayIcon::setVisible(bool visible) +{ + trayIcon->setVisible(visible); +} + +void TrayIcon::closeAll() +{ + trayIcon->hide(); + trayIcon->deleteLater(); + qApp->exit(); +} diff --git a/trayicon/trayicon.h b/trayicon/trayicon.h new file mode 100644 index 0000000..269e425 --- /dev/null +++ b/trayicon/trayicon.h @@ -0,0 +1,66 @@ +#ifndef TRAYICON_H +#define TRAYICON_H + +/** + * 托盘图标控件 作者:feiyangqingyun(QQ:517216493) 2017-1-8 + * 1. 可设置托盘图标对应所属主窗体。 + * 2. 可设置托盘图标。 + * 3. 可设置提示信息。 + * 4. 自带右键菜单。 + */ + +#include +#include + +class QMenu; + +#ifdef quc +class Q_DECL_EXPORT TrayIcon : public QObject +#else +class TrayIcon : public QObject +#endif + +{ + Q_OBJECT +public: + static TrayIcon *Instance(); + explicit TrayIcon(QObject *parent = 0); + +private: + static QScopedPointer self; + QWidget *mainWidget; //对应所属主窗体 + QSystemTrayIcon *trayIcon; //托盘对象 + QMenu *menu; //右键菜单 + bool exitDirect; //是否直接退出 + +private slots: + void iconIsActived(QSystemTrayIcon::ActivationReason reason); + +public: + bool getVisible() const; + +public Q_SLOTS: + //设置是否直接退出,如果不是直接退出则发送信号给主界面 + void setExitDirect(bool exitDirect); + + //设置所属主窗体 + void setMainWidget(QWidget *mainWidget); + + //显示消息 + void showMessage(const QString &title, const QString &msg, + QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 5000); + + //设置图标 + void setIcon(const QString &strIcon); + //设置提示信息 + void setToolTip(const QString &tip); + //设置是否可见 + void setVisible(bool visible); + //退出所有 + void closeAll(); + +Q_SIGNALS: + void trayIconExit(); +}; + +#endif // TRAYICON_H diff --git a/trayicon/trayicon.pro b/trayicon/trayicon.pro new file mode 100644 index 0000000..7fb2b75 --- /dev/null +++ b/trayicon/trayicon.pro @@ -0,0 +1,19 @@ +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat + +TARGET = trayicon +TEMPLATE = app +DESTDIR = $$PWD/../bin +CONFIG += warn_off + +SOURCES += main.cpp +SOURCES += frmtrayicon.cpp +SOURCES += trayicon.cpp + +HEADERS += frmtrayicon.h +HEADERS += trayicon.h + +FORMS += frmtrayicon.ui +RESOURCES += main.qrc + diff --git a/zhtopy/frmzhtopy.ui b/zhtopy/frmzhtopy.ui index 6febd1c..235a907 100644 --- a/zhtopy/frmzhtopy.ui +++ b/zhtopy/frmzhtopy.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 800 + 600