diff --git a/QtUdpEx/ExTrans/ExTrans.cpp b/QtUdpEx/ExTrans/ExTrans.cpp new file mode 100644 index 0000000..cb3b782 --- /dev/null +++ b/QtUdpEx/ExTrans/ExTrans.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2019 ~ 2019 touwoyimuli. All rights reserved. + * + * Author: touwoyimuli + * + * github: https://github.com/touwoyimuli + * blogs: https://touwoyimuli.github.io/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ExTrans.h" +#include "ui_ExTrans.h" + +ExTrans::ExTrans(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::ExTrans) +{ + ui->setupUi(this); + setWindowTitle("Tcp通信:unicast(单播) + broadcast(广播)的使用"); +} + +ExTrans::~ExTrans() +{ + delete ui; +} + +void ExTrans::on_actBind_triggered() +{ + +} + +void ExTrans::on_actDisbind_triggered() +{ + +} + +void ExTrans::on_actClean_triggered() +{ + +} + +void ExTrans::on_actQuit_triggered() +{ + close(); +} diff --git a/QtUdpEx/ExTrans/ExTrans.h b/QtUdpEx/ExTrans/ExTrans.h new file mode 100644 index 0000000..f0c8e57 --- /dev/null +++ b/QtUdpEx/ExTrans/ExTrans.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 ~ 2019 touwoyimuli. All rights reserved. + * + * Author: touwoyimuli + * + * github: https://github.com/touwoyimuli + * blogs: https://touwoyimuli.github.io/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef EXTRANS_H +#define EXTRANS_H + +#include + +namespace Ui { +class ExTrans; +} + +class ExTrans : public QMainWindow +{ + Q_OBJECT + +public: + explicit ExTrans(QWidget *parent = nullptr); + ~ExTrans(); + +private slots: + void on_actBind_triggered(); + void on_actDisbind_triggered(); + void on_actClean_triggered(); + void on_actQuit_triggered(); + +private: + Ui::ExTrans *ui; +}; + +#endif // EXTRANS_H diff --git a/QtUdpEx/ExTrans/ExTrans.pro b/QtUdpEx/ExTrans/ExTrans.pro new file mode 100644 index 0000000..1708512 --- /dev/null +++ b/QtUdpEx/ExTrans/ExTrans.pro @@ -0,0 +1,55 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-11-29T22:57:12 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = ExTrans +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +CONFIG += c++11 + +SOURCES += \ + main.cpp \ + ExTrans.cpp + +HEADERS += \ + ExTrans.h + +FORMS += \ + ExTrans.ui + +macx { +ICON = images/icon.icns +} + +unix:!macx{ +# linux only +} + +win32 { +RC_ICONS = images/icon.ico +} + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + resources.qrc diff --git a/QtUdpEx/ExTrans/ExTrans.ui b/QtUdpEx/ExTrans/ExTrans.ui new file mode 100644 index 0000000..3023f94 --- /dev/null +++ b/QtUdpEx/ExTrans/ExTrans.ui @@ -0,0 +1,186 @@ + + + ExTrans + + + + 0 + 0 + 671 + 448 + + + + ExTrans + + + + + + + + + + + 绑定端口: + + + + + + + 65000 + + + 8888 + + + + + + + + + + + 目标地址: + + + + + + + + + + + + + + 目标端口: + + + + + + + 65000 + + + 10000 + + + + + + + + + + + + + + + + 单播发送 + + + + + + + 广播发送 + + + + + + + + + + + + + + 0 + 0 + 671 + 25 + + + + + + Qt::ToolButtonTextBesideIcon + + + TopToolBarArea + + + false + + + + + + + + + + + + + :/images/Image6.png:/images/Image6.png + + + 绑定 + + + 绑定端口 + + + + + + :/images/Image3.png:/images/Image3.png + + + 解绑定 + + + 解除绑定 + + + + + + :/images/Image1.png:/images/Image1.png + + + 清空 + + + 清空文本 + + + + + + :/images/Image2.jpg:/images/Image2.jpg + + + 退出 + + + 退出程序 + + + + + + + + + diff --git a/QtUdpEx/ExTrans/images/Image1.png b/QtUdpEx/ExTrans/images/Image1.png new file mode 100644 index 0000000..c2c4e0d Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image1.png differ diff --git a/QtUdpEx/ExTrans/images/Image2.jpg b/QtUdpEx/ExTrans/images/Image2.jpg new file mode 100644 index 0000000..46070af Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image2.jpg differ diff --git a/QtUdpEx/ExTrans/images/Image3.png b/QtUdpEx/ExTrans/images/Image3.png new file mode 100644 index 0000000..c9045da Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image3.png differ diff --git a/QtUdpEx/ExTrans/images/Image4.png b/QtUdpEx/ExTrans/images/Image4.png new file mode 100644 index 0000000..0319033 Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image4.png differ diff --git a/QtUdpEx/ExTrans/images/Image5.png b/QtUdpEx/ExTrans/images/Image5.png new file mode 100644 index 0000000..95ecf80 Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image5.png differ diff --git a/QtUdpEx/ExTrans/images/Image6.png b/QtUdpEx/ExTrans/images/Image6.png new file mode 100644 index 0000000..d246ada Binary files /dev/null and b/QtUdpEx/ExTrans/images/Image6.png differ diff --git a/QtUdpEx/ExTrans/images/icon.icns b/QtUdpEx/ExTrans/images/icon.icns new file mode 100755 index 0000000..4f20853 Binary files /dev/null and b/QtUdpEx/ExTrans/images/icon.icns differ diff --git a/QtUdpEx/ExTrans/images/icon.ico b/QtUdpEx/ExTrans/images/icon.ico new file mode 100755 index 0000000..0ee0568 Binary files /dev/null and b/QtUdpEx/ExTrans/images/icon.ico differ diff --git a/QtUdpEx/ExTrans/main.cpp b/QtUdpEx/ExTrans/main.cpp new file mode 100644 index 0000000..d251184 --- /dev/null +++ b/QtUdpEx/ExTrans/main.cpp @@ -0,0 +1,11 @@ +#include "ExTrans.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ExTrans w; + w.show(); + + return a.exec(); +} diff --git a/QtUdpEx/ExTrans/resources.qrc b/QtUdpEx/ExTrans/resources.qrc new file mode 100644 index 0000000..61e6e1d --- /dev/null +++ b/QtUdpEx/ExTrans/resources.qrc @@ -0,0 +1,10 @@ + + + images/Image1.png + images/Image2.jpg + images/Image3.png + images/Image4.png + images/Image5.png + images/Image6.png + + diff --git a/README.md b/README.md index d948be5..7306c9f 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,12 @@ ## 第一部分:预备知识 -- `windows`环境下安装`Qt Creator`作为`c++`的**IDE**开发工具,学习和使用**qt** (推荐) +- `windows10`环境下安装`Qt Creator5.9.8`作为`c++`的**IDE**开发工具,学习和使用**qt** (最佳推荐) +- `MacOS10.14.6`环境下安装`QtCreator5.9.8`作为`c++`的**IDE**开发工具,学习和使用**qt**(推荐) - [Qt Creator 安装SDK,在MSVC编译模式下使用CDB调试器](https://blog.csdn.net/qq_33154343/article/details/98779698) - `windows`环境下安装`Qt Creator` + `Visual Studio 2015`作为`c++`的`IDE`开发工具,学习和使用**qt** (备选) - [`windows`环境下安装`Qt Creator 5.9` + `Visual Studio 2017专业版`](https://blog.csdn.net/qq_33154343/article/details/78587699) 参考此文 (备选) -- `Qt Creator` **IDE**的界面组成和使用讲解 +- `Qt Creator` 此**IDE**的界面基本组成和入门使用讲解 - 编写一个**qt**的第一个项目: `Hello World`的项目
@@ -64,13 +65,25 @@ - 目录树组件`QTreeWidget`和停靠区域组件`QDockWidget`的用法【QtQTreeWidgetEx】 - 【QtQTableWidgetEx】 - 【QtQFileSystemModelEx】 +- 【QtQDialogEx】 +- 【QtQStandardItemModelEx】 +- 【QtQStringListModelEx】 +- 自定义风格控件样式【QtCustomDialogEx】 +- 多文档界面MDI(Multi-document Interface)的实现,QMdiArea使用【QtMDIEx】 + + + +## 第四部分:网络编程 + +- 主机信息查询QHostInfo和QNetworkInterface查询IP等【QtQHostInfoEx】 +- TCP通信之QTcpServer和QTcpSocket,服务器和客户端通讯【QtTcpEx】
-## 第四部分:自定义风格样式QStyle +## 扩展部分:自定义风格样式QStyle - 自定义`QStyle`界面所有控件的风格,换肤效果的教程,自定义继承`QCommonStyle`的风格类【QtCustomStyleEx】 -- 预备知识:`QStyle`、`QCommonStyle`d等讲解 +- 预备知识:`QStyle`、`QCommonStyle`等讲解 - [更换`Qt`应用程序的界面`UI`,实现换肤,改用自带其他默认`QStyle`风格样式](https://mp.csdn.net/mdeditor/100148539#) - [`QStyle`自定义重绘滑动条`QSlider`控件](https://blog.csdn.net/qq_33154343/article/details/100545769) - [`QStyle`自定义重绘`QRubberBand`控件](https://blog.csdn.net/qq_33154343/article/details/100588428) @@ -109,9 +122,9 @@ ## 同步github.io博客: -- github.io的同步总目录:[WiKi](https://github.com/touwoyimuli/QtExamples/wiki/Qt%E6%8E%A8%E5%80%92%E9%87%8D%E5%AD%A6%E7%B3%BB%E5%88%97--%E6%80%BB%E7%9B%AE%E5%BD%95%E3%80%90github.io%E3%80%91) +- `github.io`的同步总目录:[WiKi](https://github.com/touwoyimuli/QtExamples/wiki/Qt%E6%8E%A8%E5%80%92%E9%87%8D%E5%AD%A6%E7%B3%BB%E5%88%97--%E6%80%BB%E7%9B%AE%E5%BD%95%E3%80%90github.io%E3%80%91) -- Qt Creator使用小技巧:[WiKi](https://github.com/touwoyimuli/QtExamples/wiki/Qt%E4%BD%BF%E7%94%A8%E7%9A%84%E4%B8%80%E4%B8%8B%E5%B0%8F%E6%8A%80%E5%B7%A7) +- `Qt Creator`使用小技巧:[WiKi](https://github.com/touwoyimuli/QtExamples/wiki/Qt%E4%BD%BF%E7%94%A8%E7%9A%84%E4%B8%80%E4%B8%8B%E5%B0%8F%E6%8A%80%E5%B7%A7)