feat: TcpClient 客户端写槽函数
This commit is contained in:
@@ -12,3 +12,40 @@ ExTcpClient::~ExTcpClient()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ExTcpClient::getLocalIp()
|
||||
{
|
||||
QString hostName = QHostInfo::localHostName();
|
||||
QHostInfo hostInfo = QHostInfo::fromName(hostName);
|
||||
ui->plainTextEdit->appendPlainText("本机名称:" + hostName);
|
||||
QString localIp;
|
||||
|
||||
foreach (QHostAddress addr, hostInfo.addresses()) {
|
||||
if (QAbstractSocket::IPv4Protocol == addr.toString()) {
|
||||
localIp = addr.toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return localIp;
|
||||
}
|
||||
|
||||
void ExTcpClient::on_actConnect_triggered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ExTcpClient::on_actDisconnect_triggered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ExTcpClient::on_actClear_triggered()
|
||||
{
|
||||
ui->plainTextEdit->clear();
|
||||
}
|
||||
|
||||
void ExTcpClient::on_actQuit_triggered()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user