32 lines
500 B
C
32 lines
500 B
C
|
#ifndef WIDGET_H
|
||
|
#define WIDGET_H
|
||
|
|
||
|
#include <QWidget>
|
||
|
// 引入需要使用的头文件
|
||
|
#include <QTcpSocket>
|
||
|
// 引入 Qt 封装的 IP 类
|
||
|
#include <QHostAddress>
|
||
|
|
||
|
QT_BEGIN_NAMESPACE
|
||
|
namespace Ui { class Widget; }
|
||
|
QT_END_NAMESPACE
|
||
|
|
||
|
class Widget : public QWidget
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
Widget(QWidget *parent = nullptr);
|
||
|
~Widget();
|
||
|
|
||
|
private slots:
|
||
|
void on_ConnectButton_clicked();
|
||
|
|
||
|
private:
|
||
|
Ui::Widget *ui;
|
||
|
|
||
|
// 创建 QTcpSocket 类
|
||
|
QTcpSocket *socket;
|
||
|
};
|
||
|
#endif // WIDGET_H
|