1.发图片
void MainWindow::slotSendImage()
{
matrix.rotate(90);
QPixmap tempPixmap = pixmap.transformed(matrix);
QBuffer buffer;
tempPixmap.save(&buffer,"jpg");
ui->labelImage->setPixmap(tempPixmap);
int dataLength = buffer.data().size();
QByteArray ba = buffer.data();
tcpSocket->write(ba.data(), dataLength);
sendImageNum++;
ui->lineEditSendFrame->setText(QString::number(sendImageNum));
ui->lineEditSendSize->setText(QString::number(dataLength));
}
2.收图片
connect(clientSocket, &QTcpSocket