2025-05-19T17:29:21
This commit is contained in:
parent
b117c5e0be
commit
d7443a3e19
BIN
AnalysisTool-release/bin/AnalysisTool_0.9.8.2.exe
Normal file
BIN
AnalysisTool-release/bin/AnalysisTool_0.9.8.2.exe
Normal file
Binary file not shown.
3
AnalysisTool-release/bin/log/20250519.log
Normal file
3
AnalysisTool-release/bin/log/20250519.log
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[2025-05-19 14:06:15,573] main...
|
||||||
|
[2025-05-19 14:06:15,573] config config file existed.
|
||||||
|
[2025-05-19 14:06:15,819] setEventHandlerEnable...0
|
||||||
BIN
experiment_data/sample_data/19-6.xlsx
Normal file
BIN
experiment_data/sample_data/19-6.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/sample_data/~$19-6.xlsx
Normal file
BIN
experiment_data/sample_data/~$19-6.xlsx
Normal file
Binary file not shown.
@ -3,13 +3,13 @@ QT += core gui serialport printsupport
|
|||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
#CONFIG += console
|
CONFIG += console
|
||||||
|
|
||||||
CONFIG+=precompile_header
|
CONFIG+=precompile_header
|
||||||
PRECOMPILED_HEADER=stable.h
|
PRECOMPILED_HEADER=stable.h
|
||||||
|
|
||||||
#
|
#
|
||||||
VERSION = 0.9.8.1
|
VERSION = 0.9.8.3
|
||||||
# 设置目标文件名,包含版本号
|
# 设置目标文件名,包含版本号
|
||||||
TARGET = AnalysisTool_$${VERSION}
|
TARGET = AnalysisTool_$${VERSION}
|
||||||
|
|
||||||
|
|||||||
@ -279,6 +279,7 @@ bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
|
|||||||
|
|
||||||
void MainWindow::on_actionStop_triggered()
|
void MainWindow::on_actionStop_triggered()
|
||||||
{
|
{
|
||||||
|
logde<<" Stop experiment ...";
|
||||||
if(Global::_mode == Global::Mode::Experiment)
|
if(Global::_mode == Global::Mode::Experiment)
|
||||||
{
|
{
|
||||||
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop);
|
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop);
|
||||||
@ -308,6 +309,8 @@ void MainWindow::on_actionNew_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionStart_triggered()
|
void MainWindow::on_actionStart_triggered()
|
||||||
{
|
{
|
||||||
|
logde<<"start experiment,set soft into experiment mode.";
|
||||||
|
|
||||||
on_actionClearAllData_triggered();
|
on_actionClearAllData_triggered();
|
||||||
|
|
||||||
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
||||||
@ -319,8 +322,6 @@ void MainWindow::on_actionStart_triggered()
|
|||||||
|
|
||||||
Global::_mode = Global::Mode::Experiment;
|
Global::_mode = Global::Mode::Experiment;
|
||||||
|
|
||||||
logde<<"start experiment,set soft into experiment mode.";
|
|
||||||
|
|
||||||
_manuallyStopTheExperimentFlag = false;
|
_manuallyStopTheExperimentFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,6 +359,8 @@ void MainWindow::slotSaveExperimentalDataMsgBox()
|
|||||||
|
|
||||||
void MainWindow::on_actionConnectToDev_triggered()
|
void MainWindow::on_actionConnectToDev_triggered()
|
||||||
{
|
{
|
||||||
|
logde<<"Connect to device.";
|
||||||
|
|
||||||
if (SerialPort::instance()->openSp())
|
if (SerialPort::instance()->openSp())
|
||||||
{
|
{
|
||||||
setActionEnable(true);
|
setActionEnable(true);
|
||||||
@ -470,9 +473,9 @@ void MainWindow::on_actionEnthalpyCorrectionSelection_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionPrintPreview_triggered()
|
void MainWindow::on_actionPrintPreview_triggered()
|
||||||
{
|
{
|
||||||
// _printPreviewForm->setPixmap(_centralWidget->getPixMap());
|
|
||||||
// _printPreviewForm->show();
|
// _printPreviewForm->show();
|
||||||
|
|
||||||
|
_printPreviewForm->setPixmap(_centralWidget->getPixMap());
|
||||||
_printPreviewForm->_customPrintPreviewDialog->showMaximized();
|
_printPreviewForm->_customPrintPreviewDialog->showMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ bool commonDataParser(const QByteArray &ba, CommonData &cd)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
QByteArray setExperimentInfo(const QVector<Phase> &vtr)
|
QByteArray setExperimentInfo(const QVector<Phase> &vtr,const QByteArray initBa)
|
||||||
{
|
{
|
||||||
// const int phaseLength = sizeof(Phase);
|
// const int phaseLength = sizeof(Phase);
|
||||||
const int phaseLength = PHASE_BYTE_SIZE;
|
const int phaseLength = PHASE_BYTE_SIZE;
|
||||||
@ -60,19 +60,19 @@ QByteArray setExperimentInfo(const QVector<Phase> &vtr)
|
|||||||
|
|
||||||
u16 header = 0x5aa5;
|
u16 header = 0x5aa5;
|
||||||
memcpy(totalData, (char *)&header, sizeof(u16));
|
memcpy(totalData, (char *)&header, sizeof(u16));
|
||||||
// totalDataLength +=2;
|
|
||||||
|
|
||||||
totalData[2] = 1 + 2 + phaseArrayLength + 2;
|
// command + addr + data + crc
|
||||||
// totalDataLength++;
|
totalData[2] = 1 + 2 + phaseArrayLength + 2 + 2;
|
||||||
|
|
||||||
totalData[3] = 0x82;
|
totalData[3] = 0x82;
|
||||||
// totalDataLength++;
|
|
||||||
|
|
||||||
u16 address = 0x0050;
|
u16 address = 0x0050;
|
||||||
memcpy(totalData + 4, (char *)&address, sizeof(u16));
|
memcpy(totalData + 4, (char *)&address, sizeof(u16));
|
||||||
|
|
||||||
memcpy(totalData + 6, phaseArray, phaseArrayLength);
|
memcpy(totalData + 6, phaseArray, phaseArrayLength);
|
||||||
|
|
||||||
|
memcpy(totalData + 6 + phaseArrayLength,initBa.data(),2);
|
||||||
|
|
||||||
//
|
//
|
||||||
char data[300] = {};
|
char data[300] = {};
|
||||||
|
|
||||||
@ -82,13 +82,15 @@ QByteArray setExperimentInfo(const QVector<Phase> &vtr)
|
|||||||
memcpy(data + 1, (char *)&address, sizeof(u16));
|
memcpy(data + 1, (char *)&address, sizeof(u16));
|
||||||
|
|
||||||
memcpy(data + 3, phaseArray, phaseArrayLength);
|
memcpy(data + 3, phaseArray, phaseArrayLength);
|
||||||
|
// initial data
|
||||||
|
memcpy(data + 3 + phaseArrayLength,initBa.data(),2);
|
||||||
|
|
||||||
u16 crc = modbusCRC16((u8 *)data, 3 + phaseArrayLength);
|
u16 crc = modbusCRC16((u8 *)data, 3 + phaseArrayLength + 2);
|
||||||
//
|
//
|
||||||
memcpy(totalData + 6 + phaseArrayLength, (char *)&crc, sizeof(u16));
|
memcpy(totalData + 6 + phaseArrayLength + 2, (char *)&crc, sizeof(u16));
|
||||||
|
|
||||||
//
|
// header + phase data + initial data + crc.
|
||||||
return QByteArray(totalData, 6 + phaseArrayLength + 2);
|
return QByteArray(totalData, 6 + phaseArrayLength + 2 + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray setDeviceStartStop(const DeviceStartMode mode)
|
QByteArray setDeviceStartStop(const DeviceStartMode mode)
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace DataParser {
|
namespace DataParser {
|
||||||
|
|
||||||
QByteArray setExperimentInfo(const QVector<Phase>&);
|
QByteArray setExperimentInfo(const QVector<Phase>&,const QByteArray initBa);
|
||||||
QByteArray inquirePhaseInfo();
|
QByteArray inquirePhaseInfo();
|
||||||
QByteArray setDeviceStartStop(const DeviceStartMode);
|
QByteArray setDeviceStartStop(const DeviceStartMode);
|
||||||
|
|
||||||
|
|||||||
@ -140,6 +140,9 @@ void SerialPort::slotReadData()
|
|||||||
emit sigSendCommonData(cd);
|
emit sigSendCommonData(cd);
|
||||||
}
|
}
|
||||||
// emit sigSendCommonDataToRealDataForm(cd);
|
// emit sigSendCommonDataToRealDataForm(cd);
|
||||||
|
}else{
|
||||||
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
|
logde << "receive info (hex):" << hexData.toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,12 +280,10 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
|||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case DeviceStartMode::Stop:
|
case DeviceStartMode::Stop:
|
||||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
|
||||||
Global::_mode = Global::Mode::Analysis;
|
Global::_mode = Global::Mode::Analysis;
|
||||||
logde<<"set global mode analysis.";
|
logde<<"set global mode analysis.";
|
||||||
break;
|
break;
|
||||||
case DeviceStartMode::Start:
|
case DeviceStartMode::Start:
|
||||||
// Global::instance()->setMode(Global::Mode::ExperimentStart);
|
|
||||||
Global::_mode = Global::Mode::Experiment;
|
Global::_mode = Global::Mode::Experiment;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -39,7 +39,6 @@ signals:
|
|||||||
void sigSaveExperimentalDataMsgBox();
|
void sigSaveExperimentalDataMsgBox();
|
||||||
public slots:
|
public slots:
|
||||||
void slotDeliverData(const QByteArray &);
|
void slotDeliverData(const QByteArray &);
|
||||||
// void slotConnectToDevice(const QByteArray&);
|
|
||||||
void slotSendData(const QByteArray &);
|
void slotSendData(const QByteArray &);
|
||||||
void slotCloseSp();
|
void slotCloseSp();
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@ -1087,8 +1087,6 @@ void CentralWidget::loadAnalysisData(const AnalysisMode mode,const double x1,con
|
|||||||
QString str = QString::number(point.x(),'f',3);
|
QString str = QString::number(point.x(),'f',3);
|
||||||
drawText(point,str);
|
drawText(point,str);
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AnalysisMode::EndsetTemperaturePoint:{
|
case AnalysisMode::EndsetTemperaturePoint:{
|
||||||
@ -1106,6 +1104,8 @@ void CentralWidget::clearAllData()
|
|||||||
|
|
||||||
QPixmap CentralWidget::getPixMap()
|
QPixmap CentralWidget::getPixMap()
|
||||||
{
|
{
|
||||||
|
_customPlot->replot();
|
||||||
|
QApplication::processEvents();
|
||||||
return _customPlot->toPixmap();
|
return _customPlot->toPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,20 +18,6 @@ class CentralWidget:public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
#if 0
|
|
||||||
enum AnalysisMode{
|
|
||||||
Null,
|
|
||||||
NumericalLabel,
|
|
||||||
StartPoint,
|
|
||||||
StopPoint,
|
|
||||||
PeakSynthesisAnalysis,
|
|
||||||
GlassTransition,
|
|
||||||
OnsetTemperaturePoint,
|
|
||||||
EndsetTemperaturePoint
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// using AnalysisMode = Global::AnalysisMode;
|
|
||||||
using AnalysisOperation = AnalysisOperationRecorder::AnalysisOperation;
|
using AnalysisOperation = AnalysisOperationRecorder::AnalysisOperation;
|
||||||
using AnalysisMode = AnalysisOperationRecorder::AnalysisMode;
|
using AnalysisMode = AnalysisOperationRecorder::AnalysisMode;
|
||||||
|
|
||||||
@ -85,7 +71,6 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent* event);
|
void timerEvent(QTimerEvent* event);
|
||||||
// void contextMenuEvent(QContextMenuEvent *event);
|
|
||||||
private:
|
private:
|
||||||
void glassTransitionHandle(const double x1,const double x2);
|
void glassTransitionHandle(const double x1,const double x2);
|
||||||
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
|
void quadraticFit(const QVector<QPointF>& points, double& a, double& b, double& c);
|
||||||
|
|||||||
@ -415,6 +415,7 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
ei.sampleWeight = ui->sampleWeightLineEdit->text();
|
ei.sampleWeight = ui->sampleWeightLineEdit->text();
|
||||||
ei.date = ui->dateTimeLineEdit->text();
|
ei.date = ui->dateTimeLineEdit->text();
|
||||||
ei.experimentor = ui->userLineEdit->text();
|
ei.experimentor = ui->userLineEdit->text();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
ei.phaseVtr = phaseVtr;
|
ei.phaseVtr = phaseVtr;
|
||||||
if(ui->radioButton_OIT->isChecked()){
|
if(ui->radioButton_OIT->isChecked()){
|
||||||
@ -426,10 +427,22 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
|||||||
ei.initialAtmosPhere = (GasType)(ui->comboBox_phase_1_atmosphere->currentIndex());
|
ei.initialAtmosPhere = (GasType)(ui->comboBox_phase_1_atmosphere->currentIndex());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// initial data.
|
||||||
|
QByteArray initialBa;
|
||||||
|
if(ui->radioButton_OIT->isChecked()){
|
||||||
|
initialBa.append((char)0);
|
||||||
|
}else{
|
||||||
|
initialBa.append((char)1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char index = ui->comboBox_initial_atmosphere->currentIndex();
|
||||||
|
initialBa.append(index);
|
||||||
|
|
||||||
//
|
//
|
||||||
QByteArray ba = DataParser::setExperimentInfo(phaseVtr);
|
QByteArray ba = DataParser::setExperimentInfo(phaseVtr,initialBa);
|
||||||
|
|
||||||
qDebug() << "ba size:" << ba.size();
|
qDebug() << "ba size:" << ba.size();
|
||||||
|
|
||||||
emit sigDeliverData(ba);
|
emit sigDeliverData(ba);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
@ -639,7 +652,6 @@ void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba)
|
|||||||
QComboBox *atmoshpereComboBox =
|
QComboBox *atmoshpereComboBox =
|
||||||
qobject_cast<QComboBox*>(this->findChild<QObject*>(atmoshpereComboBoxName));
|
qobject_cast<QComboBox*>(this->findChild<QObject*>(atmoshpereComboBoxName));
|
||||||
if(atmoshpereComboBox){
|
if(atmoshpereComboBox){
|
||||||
qDebug()<<"gas:"<<phase.gas;
|
|
||||||
atmoshpereComboBox->setCurrentIndex(phase.gas % 256);
|
atmoshpereComboBox->setCurrentIndex(phase.gas % 256);
|
||||||
atmoshpereComboBox->setEnabled(true);
|
atmoshpereComboBox->setEnabled(true);
|
||||||
}
|
}
|
||||||
@ -649,30 +661,45 @@ void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba)
|
|||||||
// radioButton_OIT
|
// radioButton_OIT
|
||||||
// comboBox_initial_atmosphere
|
// comboBox_initial_atmosphere
|
||||||
|
|
||||||
u8 *oitValue = data + (ba.size() - 2);
|
u8 *oitValue = (data + 72);
|
||||||
|
logde<<"oit value:"<<(int)*oitValue;
|
||||||
|
|
||||||
if(*oitValue){
|
if(*oitValue){
|
||||||
|
ui->radioButton_OIT->setChecked(false);
|
||||||
|
ui->radioButton_OIT_not->setChecked(true);
|
||||||
|
#if 0
|
||||||
QString oitRadioButtonName("radioButton_OIT");
|
QString oitRadioButtonName("radioButton_OIT");
|
||||||
QRadioButton *oitRadioButton =
|
QRadioButton *oitRadioButton =
|
||||||
qobject_cast<QRadioButton*>(this->findChild<QObject*>(oitRadioButtonName));
|
qobject_cast<QRadioButton*>(this->findChild<QObject*>(oitRadioButtonName));
|
||||||
if(oitRadioButton){
|
if(oitRadioButton){
|
||||||
oitRadioButton->setChecked(true);
|
oitRadioButton->setChecked(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}else{
|
}else{
|
||||||
|
ui->radioButton_OIT->setChecked(true);
|
||||||
|
ui->radioButton_OIT_not->setChecked(false);
|
||||||
|
#if 0
|
||||||
QString oitNotRadioButtonName("radioButton_OIT_not");
|
QString oitNotRadioButtonName("radioButton_OIT_not");
|
||||||
QRadioButton *oitNotRadioButton =
|
QRadioButton *oitNotRadioButton =
|
||||||
qobject_cast<QRadioButton*>(this->findChild<QObject*>(oitNotRadioButtonName));
|
qobject_cast<QRadioButton*>(this->findChild<QObject*>(oitNotRadioButtonName));
|
||||||
if(oitNotRadioButton){
|
if(oitNotRadioButton){
|
||||||
oitNotRadioButton->setChecked(true);
|
oitNotRadioButton->setChecked(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *initAtmosphereValue = data + (ba.size() - 1);
|
u8 *initAtmosphereValue = (data + 73);
|
||||||
|
logde<<"initAtmosphereValue:"<< (int)(*initAtmosphereValue);
|
||||||
|
ui->comboBox_initial_atmosphere->setCurrentIndex((int)*initAtmosphereValue);
|
||||||
|
|
||||||
|
#if 0
|
||||||
QString initialAtmosphereComboBoxObjectName("comboBox_initial_atmosphere");
|
QString initialAtmosphereComboBoxObjectName("comboBox_initial_atmosphere");
|
||||||
QComboBox *initialAtmosphereComboBox =
|
QComboBox *initialAtmosphereComboBox =
|
||||||
qobject_cast<QComboBox*>(this->findChild<QObject*>(initialAtmosphereComboBoxObjectName));
|
qobject_cast<QComboBox*>(this->findChild<QObject*>(initialAtmosphereComboBoxObjectName));
|
||||||
if(initialAtmosphereComboBox){
|
if(initialAtmosphereComboBox){
|
||||||
initialAtmosphereComboBox->setCurrentIndex(*initAtmosphereValue);
|
initialAtmosphereComboBox->setCurrentIndex(*initAtmosphereValue);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "printpreviewform.h"
|
#include "printpreviewform.h"
|
||||||
#include "ui_printpreviewform.h"
|
#include "ui_printpreviewform.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -11,7 +12,6 @@ PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
||||||
_printer->setPageSize(QPageSize(QPageSize::A4));
|
_printer->setPageSize(QPageSize(QPageSize::A4));
|
||||||
_printer->setOrientation(QPrinter::Landscape);
|
_printer->setOrientation(QPrinter::Landscape);
|
||||||
|
|
||||||
@ -30,9 +30,13 @@ PrintPreviewForm::~PrintPreviewForm()
|
|||||||
|
|
||||||
void PrintPreviewForm::setPixmap(const QPixmap &pixmap)
|
void PrintPreviewForm::setPixmap(const QPixmap &pixmap)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
QPixmap localPixmap = pixmap;
|
QPixmap localPixmap = pixmap;
|
||||||
localPixmap.scaled(ui->labelPixmap->size());
|
localPixmap.scaled(ui->labelPixmap->size());
|
||||||
ui->labelPixmap->setPixmap(pixmap);
|
ui->labelPixmap->setPixmap(pixmap);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_pixmap = pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -41,6 +45,15 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
printer->setOrientation(QPrinter::Landscape);
|
printer->setOrientation(QPrinter::Landscape);
|
||||||
QPainter painter(printer);
|
QPainter painter(printer);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// 重置 painter 状态(清除之前的设置)
|
||||||
|
painter.resetTransform();
|
||||||
|
painter.setPen(Qt::black);
|
||||||
|
painter.setBrush(Qt::NoBrush);
|
||||||
|
painter.setOpacity(1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// 绘制第一页(不需要先调用 newPage())
|
// 绘制第一页(不需要先调用 newPage())
|
||||||
// painter.drawText(100, 100, "Page 1");
|
// painter.drawText(100, 100, "Page 1");
|
||||||
|
|
||||||
@ -49,8 +62,6 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
|
|
||||||
// painter.drawText(pageRect.width()/2 - 50, 100, "Page 1"); // 居中显示
|
// painter.drawText(pageRect.width()/2 - 50, 100, "Page 1"); // 居中显示
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// 绘制矩形框
|
// 绘制矩形框
|
||||||
QRect frameRect(50, 50, pageRect.width() - 100, pageRect.height() - 100);
|
QRect frameRect(50, 50, pageRect.width() - 100, pageRect.height() - 100);
|
||||||
@ -65,13 +76,13 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
// Draw image.
|
// Draw image.
|
||||||
QRect imageRect = frameRect;
|
QRect imageRect = frameRect;
|
||||||
imageRect.setHeight(imageRect.height() - 200);
|
imageRect.setHeight(imageRect.height() - 200);
|
||||||
QPixmap pixmap(":/curve.png"); // 确保这个路径是正确的
|
// QPixmap pixmap(":/curve.png"); // 确保这个路径是正确的
|
||||||
if (!pixmap.isNull()) {
|
if (!_pixmap.isNull()) {
|
||||||
#if 0
|
#if 0
|
||||||
QRect pixmapRect = pixmap.rect();
|
QRect pixmapRect = pixmap.rect();
|
||||||
pixmapRect.moveCenter(pageRect.center());
|
pixmapRect.moveCenter(pageRect.center());
|
||||||
#endif
|
#endif
|
||||||
painter.drawPixmap(imageRect, pixmap);
|
painter.drawPixmap(imageRect, _pixmap);
|
||||||
}else{
|
}else{
|
||||||
qDebug()<<" file not exist";
|
qDebug()<<" file not exist";
|
||||||
}
|
}
|
||||||
@ -82,16 +93,32 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
painter.drawText(fileInfoRect, Qt::AlignLeft|Qt::AlignVCenter, " Hello, World!");
|
painter.drawText(fileInfoRect, Qt::AlignLeft|Qt::AlignVCenter, " Hello, World!");
|
||||||
|
|
||||||
// Experiment info.
|
// Experiment info.
|
||||||
|
// Only print the first experiment data.
|
||||||
QRect experimentRect(frameRect.x(),fileInfoRect.y() + fileInfoRect.height(),
|
QRect experimentRect(frameRect.x(),fileInfoRect.y() + fileInfoRect.height(),
|
||||||
400,frameRect.height() - imageRect.height() - fileInfoRect.height());
|
400,frameRect.height() - imageRect.height() - fileInfoRect.height());
|
||||||
painter.drawRect(experimentRect);
|
painter.drawRect(experimentRect);
|
||||||
|
|
||||||
QString experimentInfoStr = QString(" 实验员:%1 \n"
|
Global::ExperimentInfo & exInfo = Global::_curveFileDataVtr.first().ei;
|
||||||
" 时间:%2 \n").arg("Jay").arg("20250101");
|
|
||||||
|
QString experimentInfoStr = QString(" 样品名称:%1 \n"
|
||||||
|
" 样品重量:%2 \n"
|
||||||
|
" 实验日期:%3 \n"
|
||||||
|
" 实验人员:%4 \n"
|
||||||
|
)
|
||||||
|
.arg(exInfo.sampleName)
|
||||||
|
.arg(exInfo.sampleWeight)
|
||||||
|
.arg(exInfo.date)
|
||||||
|
.arg(exInfo.experimentor);
|
||||||
painter.drawText(experimentRect, Qt::AlignLeft|Qt::AlignVCenter, experimentInfoStr);
|
painter.drawText(experimentRect, Qt::AlignLeft|Qt::AlignVCenter, experimentInfoStr);
|
||||||
// Phase info.
|
// Phase info.
|
||||||
QRect phaseInfoRect(experimentRect.x() + experimentRect.width(),experimentRect.y(),
|
QRect phaseInfoRect(experimentRect.x() + experimentRect.width(),experimentRect.y(),
|
||||||
frameRect.width() - experimentRect.width(),experimentRect.height());
|
frameRect.width() - experimentRect.width(),experimentRect.height());
|
||||||
|
|
||||||
|
QVector<Global::PhaseTotalInfo>& phaseTotalVtr = Global::_curveFileDataVtr.first().phaseTotalVtr;
|
||||||
|
QVector<Phase> phaseVtr;
|
||||||
|
for(Global::PhaseTotalInfo& ptInfo:phaseTotalVtr){
|
||||||
|
if(ptInfo.)
|
||||||
|
}
|
||||||
QString phaseInfoStr = QString(" 气氛:%1 ; 扫描速率:%2 ; 持续时间:%3 \n").arg("Jay").arg("20250101");
|
QString phaseInfoStr = QString(" 气氛:%1 ; 扫描速率:%2 ; 持续时间:%3 \n").arg("Jay").arg("20250101");
|
||||||
painter.drawText(phaseInfoRect, Qt::AlignLeft|Qt::AlignVCenter, phaseInfoStr);
|
painter.drawText(phaseInfoRect, Qt::AlignLeft|Qt::AlignVCenter, phaseInfoStr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::PrintPreviewForm *ui;
|
Ui::PrintPreviewForm *ui;
|
||||||
QPrinter * _printer;
|
QPrinter * _printer;
|
||||||
|
QPixmap _pixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRINTPREVIEWFORM_H
|
#endif // PRINTPREVIEWFORM_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user