change export folder name follow current date time.
This commit is contained in:
parent
19f9714826
commit
67b370fd36
@ -11,6 +11,7 @@
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QDateTime>
|
||||
|
||||
#define BG_MIX_PATH ":/NameCreater/resource/background.jpg"
|
||||
#define BG_BOY_PATH ":/NameCreater/resource/background_boy.jpg"
|
||||
@ -65,11 +66,14 @@ void saveToImage(const QString& filename, QGraphicsScene* scene) {
|
||||
QPainter painter(&image);
|
||||
scene->render(&painter);
|
||||
|
||||
if (!QDir("export").exists()) {
|
||||
QDir().mkdir("export");
|
||||
|
||||
QString folder_name = "export_" + QDateTime::currentDateTime().toString("yyyyMMdd");
|
||||
|
||||
if (!QDir(folder_name).exists()) {
|
||||
QDir().mkdir(folder_name);
|
||||
}
|
||||
|
||||
image.save(QString("export/").append(filename), "JPG", 100);
|
||||
image.save(QString(folder_name).append("/").append(filename), "JPG", 100);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user