手机端:
发送文字:Capture
电脑端:
if (type == "text") {
QString message = JO.value("message").toString();
if (message == "Capture") {
QScreen *screen = QApplication::primaryScreen();
QPixmap pixmap = screen->grabWindow(QApplication::desktop()->winId());
QDateTime time = QDateTime::currentDateTime();
QString filename = time.toString("yyyyMMddhhmmss") + ".jpg";
QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/" + filename;
pixmap.save(path, nullptr, 100);
}
ui->textBrowser->append("[" + QDateTime::currentDateTime().toString("HH:mm:ss") + "] [" + IP_remote + "]:" + message);
}