#include <QSettings>
#include <QDebug>
QString dataPath;
QString cfgPath;
QString weightsPath;
//写
void WriteSettings()
{
cfgPath="/home/zyx/code/car-plate-ocr/OCR/yolov3-tiny-Rect.cfg"
dataPath="/home/zyx/code/car-plate-ocr/OCR/coco.data"
weightsPath="/home/zyx/code/car-plate-ocr/OCR/yolov3-tiny-Rect_last.weights"
QSettings modelSet("MODELSET.INI",QSettings::IniFormat);
modelSet.beginGroup("OCR");
modelSet.setValue("DataPath",dataPath);
modelSet.setValue("CfgPath",cfgPath);
modelSet.setValue("WeightsPath",weightsPath);
modelSet.endGroup();
}
//读
void ReadSettings()
{
QSettings modelSet("MODELSET.INI",QSettings::IniFormat);
dataPath = modelSet.value("OCR/DataPath").toString();
cfgPath = modelSet.value("OCR/CfgPath").toString();
weightsPath = modelSet.value("OCR/WeightsPath").toString();
qDebug() << dataPath;
qDebug() << cfgPath;
qDebug() << weightsPath;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
WriteSettings();
ReadSettings();
return a.exec();
}
MODELSET.INI
[OCR]
CfgPath=/home/zyx/code/car-plate-ocr/OCR/yolov3-tiny-Rect.cfg
DataPath=/home/zyx/code/car-plate-ocr/OCR/coco.data
WeightsPath=/home/zyx/code/car-plate-ocr/OCR/yolov3-tiny-Rect_last.weights