From 047b7959ac3ef3c2917ba1657b68c78fac56af23 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Mon, 20 Sep 2021 12:45:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QWidgetDemo.pro | 5 + QWidgetDemo.pro.user | 2964 ----------------- colorwidget/frmcolorwidget.ui | 4 +- core_qui/iconhelper.h | 17 +- .../framelesscore/framelessmainwindow.h | 2 +- gifwidget/frmgifwidget.ui | 4 +- ipaddress/frmipaddress.cpp | 1 + ipaddress/frmipaddress.ui | 14 +- ipaddress/main.cpp | 2 +- maskwidget/frmmaskwidget.cpp | 1 - maskwidget/frmmaskwidget.ui | 4 +- movewidget/frmmovewidget.ui | 4 +- navbutton/frmnavbutton.cpp | 144 +- navbutton/frmnavbutton.h | 9 + navbutton/frmnavbutton.ui | 997 +++--- navbutton/iconhelper.cpp | 126 +- navbutton/iconhelper.h | 42 +- ntpclient/frmntpclient.cpp | 1 + ntpclient/frmntpclient.ui | 4 +- ntpclient/main.cpp | 2 +- savelog/frmsavelog.h | 3 +- savelog/frmsavelog.ui | 91 +- saveruntime/frmsaveruntime.cpp | 26 +- saveruntime/frmsaveruntime.h | 3 + saveruntime/frmsaveruntime.ui | 82 +- screenwidget/frmscreenwidget.ui | 4 +- trayicon/frmtrayicon.cpp | 27 + trayicon/frmtrayicon.h | 26 + trayicon/frmtrayicon.ui | 45 + trayicon/main.cpp | 31 + trayicon/main.ico | Bin 0 -> 92854 bytes trayicon/main.qrc | 5 + trayicon/trayicon.cpp | 98 + trayicon/trayicon.h | 66 + trayicon/trayicon.pro | 19 + zhtopy/frmzhtopy.ui | 4 +- 36 files changed, 1220 insertions(+), 3657 deletions(-) delete mode 100644 QWidgetDemo.pro.user create mode 100644 trayicon/frmtrayicon.cpp create mode 100644 trayicon/frmtrayicon.h create mode 100644 trayicon/frmtrayicon.ui create mode 100644 trayicon/main.cpp create mode 100644 trayicon/main.ico create mode 100644 trayicon/main.qrc create mode 100644 trayicon/trayicon.cpp create mode 100644 trayicon/trayicon.h create mode 100644 trayicon/trayicon.pro 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 0000000000000000000000000000000000000000..34e1ca98abf814263f2f745eb471d33cebafc258 GIT binary patch literal 92854 zcmeHwYiu0Hm2OKiBRWnj*?Lg+(t0_L9&0<6tzAnSMY80`iIhvnR<0sZ8(mxB%4?DF zg%w7jW(h*P5@~4++A<7EGciaTFhFAwfcdci^CJKQ0Shoc0x%00J6a+DEnt7}0`~_4 z1i55z7wP+br>c5tdb(%2dxj6uQ_^8gch}=oeWy-UovyBOoMp}zou{5!4gVhJ^)EQi zCywK6-mI?w_j1R%f2HHBUahXTFLRv#d#{7=4#L+v|9rpWY`l-*^>w}Dj6KBg>iYFM z$N8UI9jCjS*PET~^~;>xHWPod^Uset&R@QUClVjmi1*3yWjg+5=kRq+Wl_Iq8ajuYAMT}Y);UX1j~8@PnKkjZ2wE?m?PR%SBU!PKW&+#KYy z8#<+QZ~EU;7gD_^Cb}d>CaWTx7|f(n>8{MrIuPS_=Juer4{t31HZ{$Cl`N-z;YPLB={s&X( zOSq4UKsA8UNT2*?vZp_C-CpGA&SXxy?w`6c(;XS)1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y?{8fCUQ52u=ZRm#Z&WUG=ney|@Ni+81IFMKY>wJ8%kt-ct>ir@yP;n)VDT5!{ zKJC)dM|Yl?RO4OYB>#uJuzw)VLI=l(toYm`$?Id=k7FG9!4&4Is7DZg^Sz9Xj=@ONMj{{LIdD8v8& literal 0 HcmV?d00001 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