为了方便调试,网上找来客户端例程,修改成上位机控制端。
1、pro文件
从这里,我们可以看到,必须要在.pro文件中添加QT += network才可以进行网络编程,否则是访问不到<QTcpSocket>头文件的。
客户端读写相对简单,我们看一下代码头文件:
#-------------------------------------------------
#
# Project created by QtCreator 2019-08-25T14:10:09
#
#-------------------------------------------------
QT += core gui
QT += network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = myFrist
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 += \
clientwidget.cpp \
main.cpp \
mainwindow.cpp
HEADERS += \
clientwidget.h \
mainwindow.h
FORMS += \
clientwidget.ui \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
2、client.cpp
#include "clientwidget.h"
#include "ui_clientwidget.h"
#include<QHostAddress>
#include <QDebug>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
ClientWidget::ClientWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ClientWidget)
{
ui->setupUi(this);
//初始化套接字
//tcpSocket = NULL;
//分配空间,指定父对象
tcpSocket = new QTcpSocket(this);
//建立连接的信号槽
connect(tcpSocket,&QTcpSocket::connected,
[=]()
{
ui->textEditRead->setText("恭喜,成功连接服务器!");
ui->textEditguid->setText("成功连接服务器!");
}
);
//连接建立后收到服务器数据的信号槽
connect(tcpSocket,&QTcpSocket::readyRead,
[=]()
{
//获取对方发送的内容
qint16 n =5;
QByteArray array = tcpSocket->readAll();
quint8 buf[64] = {0};
// buf[0] = array[1];
QString str1 = "Welcome";
// qint64 read(char *data, qint64 maxlen);
if(array[7] == (char)3)
{
ui->textEditRead->append("参数设置为:");
// str1.sprintf( "year:%d\tmoth:%d\tday:%d", ((quint8)array[20]+(array[19]<<8)),
// array[22]+(array[21]<<8), array[24]+(array[23]<<8));
str1.sprintf( "年:%d\t月:%d\t日:%d", ((quint8)array[20]+(array[19]<<8)),
array[22]+(array[21]<<8), array[24]+(array[23]<<8));
ui->textEditRead->append(str1);
// str1.sprintf( "V1:%d\tV2:%d\tspeed3:%d",array[10]+(array[9]<<8),
// (quint8)array[12]+(array[11]<<8), array[14]+(array[13]<<8));
str1.sprintf( "消毒桶:%d\t饮水桶:%d\t流速:%d",array[10]+(array[9]<<8),
(quint8)array[12]+(array[11]<<8), array[14]+(array[13]<<8));
ui->textEditRead->append(str1);
// str1.sprintf( "dree:%d\tweigt:%d",array[16]+(array[15]<<8),
// array[18]+(array[17]<<8));
str1.sprintf( "溶解度:%d\t药重:%d",array[16]+(array[15]<<8),
array[18]+(array[17]<<8));
ui->textEditRead->append(str1);
//sprintf(buf, "year:%d-moth:%d-day:%d", array[7], array[7], array[7]);
}else
{//显示到编辑框
ui->textEditRead->append("Recv:");
ui->textEditRead->append(array);//append,添加内容
}
}
);
//设置窗口标题
setWindowTitle("TCP客户端");
}
ClientWidget::~ClientWidget()
{
delete ui;
}
void ClientWidget::on_buttonConnect_clicked()
{
//获取服务器IP和端口
QString ip = ui->lineEditIP->text();
quint16 port = ui->lineEditPort->text().toUShort();
//主动连接服务器
tcpSocket->connectToHost(QHostAddress(ip),port);
}
void ClientWidget::on_buttonSend_clicked()
{
//获取编辑框内容
QString str = ui->textEditWrite->toPlainText();
//发送数据
tcpSocket->write( str.toUtf8().data() );
}
void ClientWidget::on_buttonClose_clicked()
{ //主动断开连接
tcpSocket->disconnectFromHost();
ui->textEditguid->setText("已断开连接!");
}
QByteArray InnitialQByteArry(qint8 in[],int len)//输入int数组和数组长度,将数组中的值存入QByteArry中
{
QByteArray byteArry;
byteArry.resize(len);
for (int i=0;i<len;i++)
{
byteArry[i]=in[i];
}
return byteArry;
}
void ClientWidget::on_buttonSet_clicked()
{
/*
lineEditset1
lineEditset1
lineEditset1
lineEditset1
*/
qint16 num ,n =13;
//发送数据
//tcpSocket->write( str.toUtf8().data() );
qint8 buf[43] = {0x00,0x00,0x00,0x00,0x00,0x06,0x01,0x10,0x00,0x00,0x00,0x10,0x20};
num = ui->lineEditset1->text().toShort();
buf[n+0] = num>>8;
buf[n+1] =(qint8) num;
num = ui->lineEditset2->text().toShort();
buf[n+2] = num>>8;
buf[n+3] =(qint8) num;
num = ui->lineEditset3->text().toShort();
buf[n+4] = num>>8;
buf[n+5] =(qint8) num;
num = ui->lineEditset4->text().toShort();
buf[n+6] = num>>8;
buf[n+7] =(qint8) num;
num = ui->lineEditset5->text().toShort();
buf[n+8] = num>>8;
buf[n+9] =(qint8) num;
num = ui->lineEditset6->text().toShort();
buf[n+10] = num>>8;
buf[n+11] =(qint8) num;
num = ui->lineEditset7->text().toShort();
buf[n+12] = num>>8;
buf[n+13] =(qint8) num;
num = ui->lineEditset7_2->text().toShort();
buf[n+14] = num>>8;
buf[n+15] =(qint8) num;
num = ui->lineEditset8->text().toShort();
buf[n+16] = num>>8;
buf[n+17] =(qint8) num;
num = ui->lineEditset8_2->text().toShort();
buf[n+18] = num>>8;
buf[n+19] =(qint8) num;
num = ui->lineEditset9->text().toShort();
buf[n+20] = num>>8;
buf[n+21] =(qint8) num;
num = ui->lineEditset9_2->text().toShort();
buf[n+22] = num>>8;
buf[n+23] =(qint8) num;
num = ui->lineEditset10->text().toShort();
buf[n+24] = num>>8;
buf[n+25] =(qint8) num;
num = ui->lineEditset10_2->text().toShort();
buf[n+26] = num>>8;
buf[n+27] =(qint8) num;
//lineEditset7_2
num = 0;
if(ui->checkBox_1->isChecked() ){
qDebug("checkBox_1");
num |= 1;
}
if(ui->checkBox_2->isChecked() ){
qDebug("checkBox_2");
num |= 1<<1;
}
if(ui->checkBox_3->isChecked() ){
qDebug("checkBox_3");
num |= 1<<2;
}
if(ui->checkBox_4->isChecked() ){
qDebug("checkBox_4");
num |= 1<<3;
}
if(ui->checkBox_5->isChecked() ){
qDebug("checkBox_5");
num |= 1<<4;
}
if(ui->checkBox_6->isChecked() ){
qDebug("checkBox_6");
num |= 1<<5;
}
// qDebug()<<"num:";
// qDebug()<<num;
buf[n+28] = num>>8;
buf[n+29] =(qint8) num;
int siz =sizeof(buf)/sizeof(buf[0]);
QByteArray sendM=InnitialQByteArry(buf,siz);
tcpSocket->write( sendM);
}
void ClientWidget::on_buttonRead_clicked()
{
// qint16 addr = ui->lineEditAddr->text().toShort();
/// qint16 num = ui->lineEditNum->text().toShort();
//发送数据
//tcpSocket->write( str.toUtf8().data() );
qint8 buf[12] = {0x00,0x00,0x00,0x00,0x00,0x06,0x01,0x03,0x00,0x00,0x00,0x20};
// buf[8] = addr>>8;
// buf[9] =(qint8) addr;
// buf[10] = num>>8;
// buf[11] =(qint8) num;
int siz =sizeof(buf)/sizeof(buf[0]);
QByteArray sendM=InnitialQByteArry(buf,siz);
tcpSocket->write( sendM);
ui->textEditRead->setText("读取设置内容为:");
}
3、UI文件
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ClientWidget</class>
<widget class="QWidget" name="ClientWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>946</width>
<height>641</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="3">
<widget class="QGroupBox" name="groupBox_6">
<property name="minimumSize">
<size>
<width>450</width>
<height>580</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>560</height>
</size>
</property>
<property name="title">
<string>数据读写</string>
</property>
<widget class="QGroupBox" name="groupBox_5">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>400</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>500</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>500</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>2</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string>数据设置</string>
</property>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>消毒桶体积:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset1">
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>45</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>210</x>
<y>60</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>药物重量:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset2">
<property name="geometry">
<rect>
<x>130</x>
<y>70</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>1000</string>
</property>
</widget>
<widget class="QPushButton" name="buttonSet">
<property name="geometry">
<rect>
<x>260</x>
<y>390</y>
<width>93</width>
<height>71</height>
</rect>
</property>
<property name="text">
<string>参数设置</string>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>30</x>
<y>90</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>水泵流量:</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>30</x>
<y>60</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>饮水桶体积:</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>220</x>
<y>30</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>稀释度:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset3">
<property name="geometry">
<rect>
<x>130</x>
<y>100</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset4">
<property name="geometry">
<rect>
<x>300</x>
<y>30</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset5">
<property name="geometry">
<rect>
<x>300</x>
<y>70</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>10000</string>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>30</x>
<y>140</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>加药年月日:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset6">
<property name="geometry">
<rect>
<x>130</x>
<y>150</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>2019</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset7">
<property name="geometry">
<rect>
<x>190</x>
<y>150</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>30</x>
<y>210</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>限制时间1止:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset9">
<property name="geometry">
<rect>
<x>140</x>
<y>220</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>12</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset8">
<property name="geometry">
<rect>
<x>140</x>
<y>190</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>9</string>
</property>
</widget>
<widget class="QLabel" name="label_15">
<property name="geometry">
<rect>
<x>30</x>
<y>180</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>限制时间1起:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset10">
<property name="geometry">
<rect>
<x>140</x>
<y>250</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>14</string>
</property>
</widget>
<widget class="QLabel" name="label_16">
<property name="geometry">
<rect>
<x>30</x>
<y>240</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>限制时间2起:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset7_2">
<property name="geometry">
<rect>
<x>250</x>
<y>150</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>26</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset8_2">
<property name="geometry">
<rect>
<x>200</x>
<y>190</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>00</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset9_2">
<property name="geometry">
<rect>
<x>200</x>
<y>220</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>30</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditset10_2">
<property name="geometry">
<rect>
<x>200</x>
<y>250</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>30</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_1">
<property name="geometry">
<rect>
<x>30</x>
<y>320</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>1单元</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>30</x>
<y>350</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>2单元</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3">
<property name="geometry">
<rect>
<x>30</x>
<y>380</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>3单元</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_4">
<property name="geometry">
<rect>
<x>30</x>
<y>410</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>4单元</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_5">
<property name="geometry">
<rect>
<x>30</x>
<y>440</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>5单元</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_6">
<property name="geometry">
<rect>
<x>30</x>
<y>470</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>6单元</string>
</property>
</widget>
<widget class="QLabel" name="label_17">
<property name="geometry">
<rect>
<x>20</x>
<y>280</y>
<width>120</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<family>微软雅黑</family>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>喂药单元选择:</string>
</property>
</widget>
</widget>
</widget>
</item>
<item row="0" column="2">
<widget class="QGroupBox" name="groupBox_7">
<property name="minimumSize">
<size>
<width>300</width>
<height>560</height>
</size>
</property>
<property name="title">
<string>连接</string>
</property>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>20</x>
<y>250</y>
<width>430</width>
<height>300</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>430</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>430</width>
<height>300</height>
</size>
</property>
<property name="title">
<string>数据显示</string>
</property>
<widget class="QTextEdit" name="textEditRead">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>331</width>
<height>200</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="textEditWrite">
<property name="geometry">
<rect>
<x>20</x>
<y>230</y>
<width>331</width>
<height>51</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
</widget>
<widget class="QPushButton" name="buttonSend">
<property name="geometry">
<rect>
<x>360</x>
<y>230</y>
<width>71</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>发送数据</string>
</property>
</widget>
<widget class="QPushButton" name="buttonRead">
<property name="geometry">
<rect>
<x>360</x>
<y>20</y>
<width>71</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>读取参数</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>421</width>
<height>200</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
</size>
</property>
<property name="title">
<string>连接</string>
</property>
<widget class="QPushButton" name="buttonConnect">
<property name="geometry">
<rect>
<x>210</x>
<y>40</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>连接服务器</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>服务器端口:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditPort">
<property name="geometry">
<rect>
<x>120</x>
<y>40</y>
<width>71</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>502</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>93</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>服务器IP:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditIP">
<property name="geometry">
<rect>
<x>110</x>
<y>80</y>
<width>254</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>192.168.0.200</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>连接状态:</string>
</property>
</widget>
<widget class="QTextEdit" name="textEditguid">
<property name="geometry">
<rect>
<x>110</x>
<y>120</y>
<width>201</width>
<height>31</height>
</rect>
</property>
<property name="html">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">未连接</p></body></html></string>
</property>
</widget>
<widget class="QPushButton" name="buttonClose">
<property name="geometry">
<rect>
<x>310</x>
<y>40</y>
<width>93</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>关闭连接</string>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>