2025-03-17T21:35:07

This commit is contained in:
123 2025-03-17 21:35:08 +08:00
parent 98a2bb40d7
commit 8020ae9dd9
2 changed files with 13 additions and 7 deletions

View File

@ -4,7 +4,13 @@
#include "filemanager.h" #include "filemanager.h"
void FileManager::writeExperimentFile(const CommonData &cd)
namespace FileManager {
FileManager::ExpeInfo _expeInfo;
QFile _expeFile;
void writeExperimentFile(const CommonData &cd)
{ {
QTextStream out(&_expeFile); QTextStream out(&_expeFile);
out.setRealNumberPrecision(3); // 设置精度为三位小数 out.setRealNumberPrecision(3); // 设置精度为三位小数
@ -17,10 +23,9 @@ void FileManager::writeExperimentFile(const CommonData &cd)
// 关闭文件 // 关闭文件
_expeFile.close(); _expeFile.close();
} }
void FileManager::createExperimentFile() void createExperimentFile()
{ {
QString fileName = _expeInfo.sampleName; QString fileName = _expeInfo.sampleName;
if(fileName.isEmpty()){ if(fileName.isEmpty()){
@ -44,10 +49,11 @@ void FileManager::createExperimentFile()
} }
} }
void FileManager::test() void test()
{ {
QString fileName = "experiment.txt"; QString fileName = "experiment.txt";
QFile file; QFile file;
} }
}

View File

@ -14,10 +14,10 @@ struct ExpeInfo
QString date; QString date;
QString userName; QString userName;
}; };
ExpeInfo _expeInfo; extern ExpeInfo _expeInfo;
QFile _expeFile; extern QFile _expeFile;
void createExperimentFile(const QString&); void createExperimentFile();
void writeExperimentFile(const CommonData&); void writeExperimentFile(const CommonData&);
void test(); void test();