更新文档

This commit is contained in:
feiyangqingyun
2022-05-06 17:41:50 +08:00
parent a85b524392
commit 2a9dac19e1
10 changed files with 351 additions and 93 deletions

178
README.md
View File

@@ -1,5 +1,5 @@

#### 一、特别说明
## 一、特别说明
1. 可以选择打开QWidgetDemo.pro一次性编译所有的也可以到目录下打开pro编译。
2. 如果发现有些子项目没有加载请打开对应目录下的.pro仔细看里面的注释。
3. 编译好的可执行文件在源码同级目录下的bin目录。
@@ -9,46 +9,46 @@
8. **强烈推荐各位搭配Qt开发经验一起学习 [https://gitee.com/feiyangqingyun/qtkaifajingyan](https://gitee.com/feiyangqingyun/qtkaifajingyan)**
9. **各位有需要购买Qt商业版可以联系Qt中国商务人员微信 zzwdkxx 支持Qt。**
#### 二、目录说明
## 二、目录说明
**高质量项目加粗显示**
| 目录 | 类别 | 名称 | 描述 |
| :------: | :------: | :------: | :------ |
| control | 控件类别 | battery | **电池电量** |
| control | 控件类别 | devicebutton | **设备按钮** |
| control | 控件类别 | devicesizetable | 磁盘容量 |
| control | 控件类别 | imageswitch | 图片开关 |
| control | 控件类别 | ipaddress | IP地址输入框 |
| control | 控件类别 | lightbutton | 高亮按钮 |
| control | 控件类别 | navbutton | **导航按钮** |
| control | 控件类别 | savelog | **日志重定向输出** |
| control | 控件类别 | saveruntime | **运行时间记录** |
| control | 控件类别 | smoothcurve | 平滑曲线 |
| control | 控件类别 | zhtopy | 汉字转拼音 |
| tool | 工具类别 | comtool | **串口调试助手** |
| tool | 工具类别 | nettool | **网络调试助手** |
| tool | 工具类别 | netserver | **网络中转服务器** |
| tool | 工具类别 | base64helper | **图片文字转base** |
| tool | 工具类别 | countcode | **代码行数统计工具** |
| tool | 工具类别 | emailtool | 邮件发送工具 |
| tool | 工具类别 | moneytool | 存款利息计算器 |
| tool | 工具类别 | pngtool | 图片警告去除工具 |
| tool | 工具类别 | keytool | **秘钥生成器** |
| tool | 工具类别 | keydemo | 秘钥测试程序 |
| tool | 工具类别 | livetool | 程序启动器 |
| tool | 工具类别 | livedemo | 程序启动示例 |
| 目录 | 相关 | 名称 | 描述 |
| :-------: | :------: | :-----------------: | :-------------------------- |
| control | 控件相关 | battery | **电池电量** |
| control | 控件相关 | devicebutton | **设备按钮** |
| control | 控件相关 | devicesizetable | 磁盘容量 |
| control | 控件相关 | imageswitch | 图片开关 |
| control | 控件相关 | ipaddress | IP地址输入框 |
| control | 控件相关 | lightbutton | 高亮按钮 |
| control | 控件相关 | navbutton | **导航按钮** |
| control | 控件相关 | savelog | **日志重定向输出** |
| control | 控件相关 | saveruntime | **运行时间记录** |
| control | 控件相关 | smoothcurve | 平滑曲线 |
| control | 控件相关 | zhtopy | 汉字转拼音 |
| tool | 工具相关 | comtool | **串口调试助手** |
| tool | 工具相关 | nettool | **网络调试助手** |
| tool | 工具相关 | netserver | **网络中转服务器** |
| tool | 工具相关 | base64helper | **图片文字转base** |
| tool | 工具相关 | countcode | **代码行数统计工具** |
| tool | 工具相关 | emailtool | 邮件发送工具 |
| tool | 工具相关 | moneytool | 存款利息计算器 |
| tool | 工具相关 | pngtool | 图片警告去除工具 |
| tool | 工具相关 | keytool | **秘钥生成器** |
| tool | 工具相关 | keydemo | 秘钥测试程序 |
| tool | 工具相关 | livetool | 程序启动器 |
| tool | 工具相关 | livedemo | 程序启动示例 |
| video | 视频播放 | videobox | **视频监控布局** |
| video | 视频播放 | videopanel | **视频监控面板** |
| video | 视频播放 | videowidget | 视频监控控件 |
| video | 视频播放 | playffmpeg | 视频播放ffmpeg |
| video | 视频播放 | playvlc | 视频播放vlc |
| video | 视频播放 | plaympv | 视频播放mpv |
| widget | 窗体类别 | colorwidget | 颜色拾取器 |
| widget | 窗体类别 | framelesswidget | **通用无边框窗体** |
| widget | 窗体类别 | gifwidget | GIF录屏 |
| widget | 窗体类别 | lunarcalendarwidget | **农历控件** |
| widget | 窗体类别 | maskwidget | 通用遮罩层 |
| widget | 窗体类别 | movewidget | 通用控件移动 |
| widget | 窗体类别 | screenwidget | 屏幕截图 |
| widget | 窗体相关 | colorwidget | 颜色拾取器 |
| widget | 窗体相关 | framelesswidget | **通用无边框窗体** |
| widget | 窗体相关 | gifwidget | GIF录屏 |
| widget | 窗体相关 | lunarcalendarwidget | **农历控件** |
| widget | 窗体相关 | maskwidget | 通用遮罩层 |
| widget | 窗体相关 | movewidget | 通用控件移动 |
| widget | 窗体相关 | screenwidget | 屏幕截图 |
| ui | 界面美化 | flatui | 扁平化风格 |
| ui | 界面美化 | styledemo | **三套风格样式** |
| ui | 界面美化 | uidemo01 | 界面美化基础示例 |
@@ -56,14 +56,15 @@
| ui | 界面美化 | uidemo09 | 九宫格主界面 |
| ui | 界面美化 | uidemo10 | **扁平化主界面** |
| ui | 界面美化 | iconhelper | **超级图形字体** |
| other | 其他类别 | bgdemo | 异形窗体 |
| other | 其他类别 | dbpage | **通用数据库翻页** |
| other | 其他类别 | echartgauge | **echart图表js交互** |
| other | 其他类别 | lineeditnext | 文本框回车自动跳转 |
| other | 其他类别 | mouseline | 鼠标十字线 |
| other | 其他类别 | ntpclient | NTP校时 |
| other | 其他类别 | trayicon | 通用托盘效果 |
| other | 其他类别 | multobj2slot | 多对象共用槽 |
| other | 其他相关 | bgdemo | 异形窗体 |
| other | 其他相关 | dbpage | **通用数据库翻页** |
| other | 其他相关 | echartgauge | **echart图表js交互** |
| other | 其他相关 | lineeditnext | 文本框回车自动跳转 |
| other | 其他相关 | mouseline | 鼠标十字线 |
| other | 其他相关 | ntpclient | NTP校时 |
| other | 其他相关 | trayicon | 通用托盘效果 |
| other | 其他相关 | multobj2slot | 多对象共用槽 |
| other | 其他相关 | drawrect | 随机大量矩形 |
| third | 第三方类 | designer | QtDesigner设计师(Qt4) |
| third | 第三方类 | hotkey | 全局热键1 |
| third | 第三方类 | shortcut | 全局热键2 |
@@ -75,84 +76,137 @@
| netfriend | 网友提供 | imageviewwindow | 图片3D效果切换 |
| netfriend | 网友提供 | slidepuzzlewidget | 滑块图片验证码 |
#### 三、学习群
1. **Qt技术交流群1 46679801(已满员)**
2. **Qt技术交流群2 573199610(未满员)**
3. **Qt高级学习群 951393302(未满员,推荐此群)**
4. **Qt交流大会群 853086607(已满员)**
#### 四、效果图
##### 4.1、控件类别
## 三、效果图
### 3.1 控件相关-control
- 电池电量-battery
![](control/0snap/battery.jpg)
- 设备按钮-devicebutton
![](control/0snap/devicebutton.jpg)
- 磁盘容量-devicesizetable
![](control/0snap/devicesizetable.jpg)
- 图片开关-imageswitch
![](control/0snap/imageswitch.jpg)
- IP地址输入框-ipaddress
![](control/0snap/ipaddress.jpg)
- 高亮按钮-lightbutton
![](control/0snap/lightbutton.jpg)
- 导航按钮-navbutton
![](control/0snap/navbutton.jpg)
- 日志重定向输出-savelog
![](control/0snap/savelog.jpg)
- 运行时间记录-saveruntime
![](control/0snap/saveruntime.jpg)
- 平滑曲线-smoothcurve
![](control/0snap/smoothcurve.jpg)
- 汉字转拼音-zhtopy
![](control/0snap/zhtopy.jpg)
##### 4.2工具类别
### 3.2 工具相关-tool
- 串口调试助手-comtool
![](tool/0snap/comtool.jpg)
- 网络调试助手-nettool
![](tool/0snap/nettool.jpg)
- 网络中转服务器-netserver
![](tool/0snap/netserver.jpg)
![](tool/0snap/netserver2.jpg)
- 图片文字转base-base64helper
![](tool/0snap/base64helper.jpg)
- 代码行数统计-countcode
![](tool/0snap/countcode.jpg)
- 邮件发送工具-emailtool
![](tool/0snap/emailtool.jpg)
- 存款利息计算器-moneytool
![](tool/0snap/moneytool.jpg)
- 图片警告去除工具-pngtool
![](tool/0snap/pngtool.jpg)
- 秘钥生成器-keytool
![](tool/0snap/keytool.jpg)
- 秘钥测试程序-keydemo
![](tool/0snap/keydemo.jpg)
- 程序启动器-livetool
![](tool/0snap/livetool.jpg)
- 程序启动示例-livedemo
![](tool/0snap/livedemo.jpg)
##### 4.3视频播放
### 3.3 视频播放-video
- 视频监控布局-videobox
![](video/0snap/videobox.jpg)
- 视频监控面板-videopanel
![](video/0snap/videopanel.jpg)
- 视频监控控件-videowidget
![](video/0snap/videowidget.jpg)
- 视频播放ffmpeg-playffmpeg
![](video/0snap/playffmpeg.jpg)
- 视频播放vlc-playvlc
![](video/0snap/playvlc.jpg)
- 视频播放mpv-plaympv
![](video/0snap/plaympv.jpg)
##### 4.4窗体类别
### 3.4 窗体相关-widget
- 颜色拾取器-colorwidget
![](widget/0snap/colorwidget.jpg)
- 通用无边框窗体-framelesswidget
![](widget/0snap/framelesswidget.jpg)
- GIF录屏-gifwidget
![](widget/0snap/gifwidget.jpg)
- 农历控件-lunarcalendarwidget
![](widget/0snap/lunarcalendarwidget.jpg)
- 通用遮罩层-maskwidget
![](widget/0snap/maskwidget.jpg)
- 通用控件移动-movewidget
![](widget/0snap/movewidget.jpg)
- 屏幕截图-screenwidget
![](widget/0snap/screenwidget.jpg)
##### 4.5界面美化
### 3.5 界面美化-ui
- 扁平化风格-flatui
![](ui/0snap/flatui.jpg)
- 三套风格样式-styledemo
![](ui/0snap/styledemo.jpg)
- 界面美化基础示例-uidemo01
![](ui/0snap/uidemo01.jpg)
- 界面美化入门示例-uidemo08
![](ui/0snap/uidemo08.jpg)
- 九宫格主界面-uidemo09
![](ui/0snap/uidemo09.jpg)
- 扁平化主界面-uidemo10
![](ui/0snap/uidemo10.jpg)
- 超级图形字体-iconhelper
![](ui/0snap/iconhelper1.jpg)
![](ui/0snap/iconhelper2.jpg)
##### 4.6其他类别
### 3.6 其他相关-other
- 异形窗体-bgdemo
![](other/0snap/bgdemo.jpg)
- 通用数据库翻页-dbpage
![](other/0snap/dbpage.jpg)
- echart图表js交互-echartgauge
![](other/0snap/echartgauge.jpg)
- 文本框回车自动跳转-lineeditnext
![](other/0snap/lineeditnext.jpg)
- 鼠标十字线-mouseline
![](other/0snap/mouseline.jpg)
- NTP校时-ntpclient
![](other/0snap/ntpclient.jpg)
- 通用托盘效果-trayicon
![](other/0snap/trayicon.jpg)
- 多对象共用槽-multobj2slot
![](other/0snap/multobj2slot.jpg)
- 随机大量矩形-drawrect
![](other/0snap/drawrect.jpg)
##### 4.7第三方类
### 3.7 第三方类-third
- QtDesigner设计师(Qt4)-designer
![](third/0snap/designer.jpg)
- 全局热键1-hotkey
![](third/0snap/hotkey.jpg)
- 全局热键2-shortcut
![](third/0snap/shortcut.jpg)
- 浏览器miniblink内核-miniblink
![](third/0snap/miniblink.jpg)
- 无插件qwt示例-qwtdemo
![](third/0snap/qwtdemo.jpg)
- 精美图表qcustomplot示例-qcustomplotdemo
![](third/0snap/qcustomplotdemo1.jpg)
![](third/0snap/qcustomplotdemo2.jpg)
![](third/0snap/qcustomplotdemo3.jpg)
@@ -162,8 +216,18 @@
![](third/0snap/qcustomplotdemo7.jpg)
![](third/0snap/qcustomplotdemo8.jpg)
##### 4.8网友提供
### 3.8 网友提供-netfriend
- 动态StackWidget-astackwidget
![](netfriend/0snap/astackwidget.jpg)
- 头像设置工具-imagecropper
![](netfriend/0snap/imagecropper.jpg)
- 图片3D效果切换-imageviewwindow
![](netfriend/0snap/imageviewwindow.jpg)
- 滑块图片验证码-slidepuzzlewidget
![](netfriend/0snap/sliderpuzzlewidget.jpg)
## 四、学习群
1. **Qt技术交流群1 46679801(已满员)**
2. **Qt技术交流群2 573199610(未满员)**
3. **Qt高级学习群 951393302(未满员,推荐此群)**
4. **Qt交流大会群 853086607(已满员)**

View File

@@ -10,6 +10,10 @@ DeviceButton::DeviceButton(QWidget *parent) : QWidget(parent)
{
canMove = false;
text = "1";
colorNormal = "black";
colorAlarm = "red";
buttonStyle = ButtonStyle_Police;
buttonColor = ButtonColor_Green;
@@ -17,9 +21,10 @@ DeviceButton::DeviceButton(QWidget *parent) : QWidget(parent)
lastPoint = QPoint();
type = "police";
imgName = QString(":/image/devicebutton/devicebutton_green_%1.png").arg(type);
isDark = false;
imgPath = ":/image/devicebutton/devicebutton";
imgName = QString("%1_green_%2.png").arg(imgPath).arg(type);
isDark = false;
timer = new QTimer(this);
timer->setInterval(500);
connect(timer, SIGNAL(timeout()), this, SLOT(checkAlarm()));
@@ -119,6 +124,16 @@ QString DeviceButton::getText() const
return this->text;
}
QString DeviceButton::getColorNormal() const
{
return this->colorNormal;
}
QString DeviceButton::getColorAlarm() const
{
return this->colorAlarm;
}
DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const
{
return this->buttonStyle;
@@ -142,9 +157,9 @@ QSize DeviceButton::minimumSizeHint() const
void DeviceButton::checkAlarm()
{
if (isDark) {
imgName = QString(":/image/devicebutton/devicebutton_black_%1.png").arg(type);
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorNormal).arg(type);
} else {
imgName = QString(":/image/devicebutton/devicebutton_red_%1.png").arg(type);
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(colorAlarm).arg(type);
}
isDark = !isDark;
@@ -164,6 +179,22 @@ void DeviceButton::setText(const QString &text)
}
}
void DeviceButton::setColorNormal(const QString &colorNormal)
{
if (this->colorNormal != colorNormal) {
this->colorNormal = colorNormal;
this->update();
}
}
void DeviceButton::setColorAlarm(const QString &colorAlarm)
{
if (this->colorAlarm != colorAlarm) {
this->colorAlarm = colorAlarm;
this->update();
}
}
void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
{
this->buttonStyle = buttonStyle;
@@ -188,25 +219,35 @@ void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
void DeviceButton::setButtonColor(const DeviceButton::ButtonColor &buttonColor)
{
//先停止定时器
this->buttonColor = buttonColor;
isDark = false;
if (timer->isActive()) {
timer->stop();
}
QString color;
if (buttonColor == ButtonColor_Green) {
imgName = QString(":/image/devicebutton/devicebutton_green_%1.png").arg(type);
color = "green";
} else if (buttonColor == ButtonColor_Blue) {
imgName = QString(":/image/devicebutton/devicebutton_blue_%1.png").arg(type);
color = "blue";
} else if (buttonColor == ButtonColor_Gray) {
imgName = QString(":/image/devicebutton/devicebutton_gray_%1.png").arg(type);
color = "gray";
} else if (buttonColor == ButtonColor_Black) {
imgName = QString(":/image/devicebutton/devicebutton_black_%1.png").arg(type);
color = "black";
} else if (buttonColor == ButtonColor_Purple) {
imgName = QString(":/image/devicebutton/devicebutton_purple_%1.png").arg(type);
color = "purple";
} else if (buttonColor == ButtonColor_Yellow) {
imgName = QString(":/image/devicebutton/devicebutton_yellow_%1.png").arg(type);
color = "yellow";
} else if (buttonColor == ButtonColor_Red) {
color = "red";
} else {
color = "green";
}
//如果和报警颜色一致则主动启动定时器切换报警颜色
imgName = QString("%1_%2_%3.png").arg(imgPath).arg(color).arg(type);
if (color == colorAlarm) {
checkAlarm();
if (!timer->isActive()) {
timer->start();

View File

@@ -5,7 +5,7 @@
* 设备按钮控件 作者:feiyangqingyun(QQ:517216493) 2018-07-02
* 1. 可设置按钮样式 圆形、警察、气泡、气泡2、消息、消息2。
* 2. 可设置按钮颜色 布防、撤防、报警、旁路、故障。
* 3. 可设置报警切换。
* 3. 可设置报警切换及对应报警切换的颜色
* 4. 可设置显示的防区号。
* 5. 可设置是否可鼠标拖动。
* 6. 发出单击和双击信号。
@@ -27,6 +27,9 @@ class DeviceButton : public QWidget
Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove)
Q_PROPERTY(QString text READ getText WRITE setText)
Q_PROPERTY(QString colorNormal READ getColorNormal WRITE setColorNormal)
Q_PROPERTY(QString colorAlarm READ getColorAlarm WRITE setColorAlarm)
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
Q_PROPERTY(ButtonColor buttonColor READ getButtonColor WRITE setButtonColor)
@@ -62,6 +65,10 @@ protected:
private:
bool canMove; //是否可移动
QString text; //显示文字
QString colorNormal; //正常颜色
QString colorAlarm; //报警颜色
ButtonStyle buttonStyle; //按钮样式
ButtonColor buttonColor; //按钮颜色
@@ -69,7 +76,9 @@ private:
QPoint lastPoint; //鼠标按下最后坐标
QString type; //图片末尾类型
QString imgPath; //背景图片路径
QString imgName; //背景图片名称
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
@@ -80,6 +89,9 @@ public:
bool getCanMove() const;
QString getText() const;
QString getColorNormal() const;
QString getColorAlarm() const;
ButtonStyle getButtonStyle() const;
ButtonColor getButtonColor() const;
@@ -91,6 +103,11 @@ public Q_SLOTS:
void setCanMove(bool canMove);
//设置显示文字
void setText(const QString &text);
//设置正常颜色和报警颜色
void setColorNormal(const QString &colorNormal);
void setColorAlarm(const QString &colorAlarm);
//设置样式
void setButtonStyle(const ButtonStyle &buttonStyle);
//设置颜色

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<width>900</width>
<height>600</height>
</rect>
</property>

BIN
other/0snap/drawrect.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,13 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = drawrect
TEMPLATE = app
DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
SOURCES += widget.cpp
HEADERS += widget.h
FORMS += widget.ui

34
other/drawrect/main.cpp Normal file
View File

@@ -0,0 +1,34 @@
#pragma execution_character_set("utf-8")
#include "widget.h"
#include <QApplication>
#include <QTextCodec>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFont font;
font.setFamily("Microsoft Yahei");
font.setPixelSize(13);
a.setFont(font);
#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
Widget w;
//w.setWindowTitle("随机大量矩形 (QQ: 517216493 WX: feiyangqingyun)");
w.show();
return a.exec();
}

42
other/drawrect/widget.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include "widget.h"
#include "ui_widget.h"
#include "qpainter.h"
#include "qtimer.h"
#include "qdebug.h"
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
{
ui->setupUi(this);
interval = 20;
count = 500;
this->setWindowTitle(QString("随机大量矩形 帧率: %1 数量: %2 (QQ: 517216493 WX: feiyangqingyun)").arg(1000 / interval).arg(count));
//定时器测试速度
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(interval);
}
Widget::~Widget()
{
delete ui;
}
void Widget::paintEvent(QPaintEvent *)
{
int width = this->width();
int height = this->height();
QPainter painter(this);
QPen pen;
pen.setWidth(2);
pen.setColor(Qt::red);
painter.setPen(pen);
for (int i = 0; i < count; ++i) {
int x = rand() % width;
int y = rand() % height;
painter.drawRect(x, y, 30, 30);
}
}

27
other/drawrect/widget.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
protected:
void paintEvent(QPaintEvent *);
private:
Ui::Widget *ui;
int interval;
int count;
};
#endif // WIDGET_H

20
other/drawrect/widget.ui Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>