Qt获取时间戳作为图片名
//保存图片 void SaveRealsenseImg() { QString picIndexName = dataSavePath; picIndexName.append("/"); //获取当前时间 QDateTime time = QDateTime::currentDateTime(); //将当前时间转为时间戳 int timeT = time.toTime_t(); QString fileName_1 = GetDateTimeStr(); QString picName = ""; int checkBoxNumIndex = -1; if (checkBoxNum != -1) { checkBoxNumIndex = checkBoxNum; fileName_1.append(QString::number(checkBoxNum)); } picName = fileName_1; picName.append(".jpg"); QString qFilePath = ""; QString qPicPath1 = picIndexName.append(picName); cv::Mat img1920; cv::Mat commonImg1 = RotateImg(commonImg); cv::resize(commonImg1, img1920, cv::Size(1080, 1920)); cv::cvtColor(img1920, img1920, CV_BGR2RGB); cv::imwrite(qPicPath1.toStdString(), img1920); }