You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
567 B
38 lines
567 B
2 years ago
|
#ifndef WIDGET_H
|
||
|
#define WIDGET_H
|
||
|
|
||
|
#include <QWidget>
|
||
|
//添加头文件Qudpsocket
|
||
|
#include <QUdpSocket>
|
||
|
|
||
|
namespace Ui {
|
||
|
class Widget;
|
||
|
}
|
||
|
|
||
|
class Widget : public QWidget
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit Widget(QWidget *parent = 0);
|
||
|
~Widget();
|
||
|
|
||
|
//1.创建对象
|
||
|
QUdpSocket *udpSocket;
|
||
|
|
||
|
private slots:
|
||
|
//2.打开连接槽函数
|
||
|
void on_btnOpen_clicked();
|
||
|
//3.readyRead槽函数
|
||
|
void readyRead();
|
||
|
//4.发送
|
||
|
void on_btnSend_clicked();
|
||
|
//关闭
|
||
|
void on_btnClose_clicked();
|
||
|
|
||
|
private:
|
||
|
Ui::Widget *ui;
|
||
|
};
|
||
|
|
||
|
#endif // WIDGET_H
|