CodeLibrary/05_QtCreator_Cplus_TCPServer_20240423/thread.cpp
JRNitre b01d9fbda0 追加了好多 Cplus 项目...
删除了一些不明所以的 Cplus 项目
2024-06-15 00:06:15 +08:00

27 lines
454 B
C++

#include "thread.h"
Thread::Thread(QTcpSocket *s)
{
isStop = false;
socket = s;
}
void Thread::myTimeout(){
while (!isStop){
connect(socket, &QTcpSocket::readyRead, this, &Thread::clientInfoSlots);
if (isStop){
break;
}
}
}
void Thread::clientInfoSlots(){
QByteArray ba = socket->readAll();
// 发送信号
emit sendToWidget(ba);
}
void Thread::setFlag(bool flag){
isStop = flag;
}