2025-10-24T17:06:35
This commit is contained in:
parent
5989b9686a
commit
97a06a34ab
69
DSCAnalysisTool-release/bin/log/20251023.log
Normal file
69
DSCAnalysisTool-release/bin/log/20251023.log
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
[2025-10-23 08:54:20,276] main...
|
||||||
|
[2025-10-23 08:54:20,278] config file existed.
|
||||||
|
[2025-10-23 08:54:20,292] version:1.3.5.1
|
||||||
|
[2025-10-23 08:54:20,299] setEventHandlerEnable...0
|
||||||
|
[2025-10-23 08:54:23,884] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/24-new.xlsx
|
||||||
|
[2025-10-23 08:54:23,907] xlsx sample weight:1
|
||||||
|
[2025-10-23 08:54:23,908] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:24,670] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/氧化诱导期11111.xlsx
|
||||||
|
[2025-10-23 08:54:24,690] xlsx sample weight:1
|
||||||
|
[2025-10-23 08:54:24,691] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:25,186] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/333new.xlsx
|
||||||
|
[2025-10-23 08:54:25,189] xlsx sample weight:
|
||||||
|
[2025-10-23 08:54:25,189] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:25,804] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/23-1new.xlsx
|
||||||
|
[2025-10-23 08:54:25,806] xlsx sample weight:
|
||||||
|
[2025-10-23 08:54:25,806] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:26,311] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/22new.xlsx
|
||||||
|
[2025-10-23 08:54:26,314] xlsx sample weight:
|
||||||
|
[2025-10-23 08:54:26,314] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:26,850] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/1111new.xlsx
|
||||||
|
[2025-10-23 08:54:26,853] xlsx sample weight:
|
||||||
|
[2025-10-23 08:54:26,853] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:27,385] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/new.xlsx
|
||||||
|
[2025-10-23 08:54:27,390] xlsx sample weight:1
|
||||||
|
[2025-10-23 08:54:27,390] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:27,907] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/sample_data/氮气氧气Oit2.xlsx
|
||||||
|
[2025-10-23 08:54:27,941] xlsx sample weight:26.89
|
||||||
|
[2025-10-23 08:54:27,943] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:30,297] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/analysis_state/new.xlsx
|
||||||
|
[2025-10-23 08:54:30,365] xlsx sample weight:26.89
|
||||||
|
[2025-10-23 08:54:30,369] ana op size:1
|
||||||
|
[2025-10-23 08:54:30,369] cfd filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/analysis_state/new.xlsx
|
||||||
|
[2025-10-23 08:54:30,369] ao mode:OIT
|
||||||
|
[2025-10-23 08:54:30,371] x1:33.1687,x2:91.1893
|
||||||
|
[2025-10-23 08:54:30,382] calculateAnalysisResult...
|
||||||
|
[2025-10-23 08:54:30,382] x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:30,382] oit x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:30,382] startEd phase index:1
|
||||||
|
[2025-10-23 08:54:30,382] edSelectTimeX2 phase index:2
|
||||||
|
[2025-10-23 08:54:30,382] start runtime:2.74252
|
||||||
|
[2025-10-23 08:54:30,382] end runtime:63.0387
|
||||||
|
[2025-10-23 08:54:30,382] step:1
|
||||||
|
[2025-10-23 08:54:30,382] start/end offset:0.1,0.2
|
||||||
|
[2025-10-23 08:54:30,838] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/analysis_state/sample.xlsx
|
||||||
|
[2025-10-23 08:54:30,850] xlsx sample weight:17.2800006866455
|
||||||
|
[2025-10-23 08:54:30,850] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:30,856] calculateAnalysisResult...
|
||||||
|
[2025-10-23 08:54:30,856] x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:30,856] oit x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:30,856] startEd phase index:1
|
||||||
|
[2025-10-23 08:54:30,856] edSelectTimeX2 phase index:2
|
||||||
|
[2025-10-23 08:54:30,856] start runtime:2.74252
|
||||||
|
[2025-10-23 08:54:30,856] end runtime:63.0387
|
||||||
|
[2025-10-23 08:54:30,856] step:2
|
||||||
|
[2025-10-23 08:54:30,856] start/end offset:0.2,0.4
|
||||||
|
[2025-10-23 08:54:31,454] slotRecvAnalysisFileName, filePath:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/analysis_state/标样.xlsx
|
||||||
|
[2025-10-23 08:54:31,475] xlsx sample weight:13.9200000762939
|
||||||
|
[2025-10-23 08:54:31,475] Cell does not exist.
|
||||||
|
[2025-10-23 08:54:31,483] calculateAnalysisResult...
|
||||||
|
[2025-10-23 08:54:31,483] x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:31,483] oit x1,x2:33.1687,91.1893
|
||||||
|
[2025-10-23 08:54:31,483] startEd phase index:1
|
||||||
|
[2025-10-23 08:54:31,483] edSelectTimeX2 phase index:2
|
||||||
|
[2025-10-23 08:54:31,483] start runtime:2.74252
|
||||||
|
[2025-10-23 08:54:31,483] end runtime:63.0387
|
||||||
|
[2025-10-23 08:54:31,483] step:2
|
||||||
|
[2025-10-23 08:54:31,483] start/end offset:0.2,0.4
|
||||||
|
[2025-10-23 08:54:33,770] selected Curve:D:/gitfile/analysis_tool/DSCAnalysisTool-release/bin/../experiment_data/analysis_state/标样.xlsx
|
||||||
|
[2025-10-23 08:54:39,130] serialport destructor.
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,7 +9,7 @@ CONFIG+=precompile_header
|
|||||||
PRECOMPILED_HEADER=stable.h
|
PRECOMPILED_HEADER=stable.h
|
||||||
|
|
||||||
#
|
#
|
||||||
VERSION = 1.3.6
|
VERSION = 1.3.7
|
||||||
# 设置目标文件名,包含版本号
|
# 设置目标文件名,包含版本号
|
||||||
TARGET = DSCAnalysisTool_$${VERSION}
|
TARGET = DSCAnalysisTool_$${VERSION}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
|
|
||||||
|
#include "logger/logger.h"
|
||||||
#include "lowesssmoother.h"
|
#include "lowesssmoother.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
@ -33,6 +34,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
_manuallyStopTheExperimentFlag(false) {
|
_manuallyStopTheExperimentFlag(false) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->actionOITAutoAnalysisMode->setVisible(false);
|
ui->actionOITAutoAnalysisMode->setVisible(false);
|
||||||
|
ui->toolBar->setWindowTitle("工具栏");
|
||||||
|
|
||||||
this->setToolTip(".....");
|
this->setToolTip(".....");
|
||||||
|
|
||||||
ui->actionSaveas->setVisible(false);
|
ui->actionSaveas->setVisible(false);
|
||||||
@ -43,10 +46,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, _rightWidget);
|
addDockWidget(Qt::RightDockWidgetArea, _rightWidget);
|
||||||
|
|
||||||
|
_rightWidget->setWindowTitle("分析设置");
|
||||||
_rightWidget->setWidget(_analysisSettingWidget);
|
_rightWidget->setWidget(_analysisSettingWidget);
|
||||||
_rightWidget->hide();
|
_rightWidget->hide();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
ui->statusbar->showMessage("showMessage show temp message!");
|
ui->statusbar->showMessage("showMessage show temp message!");
|
||||||
|
|
||||||
@ -686,10 +689,19 @@ void MainWindow::on_actionEnthalpyCorrectionSelection_triggered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionPrintPreview_triggered() {
|
void MainWindow::on_actionPrintPreview_triggered() {
|
||||||
// _printPreviewForm->show();
|
logde << "print preview...";
|
||||||
|
|
||||||
|
if(Global::_curveFileDataVtr.empty()){
|
||||||
|
showMesgBox("请先打开数据。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_printPreviewForm->setPixmap(_centralWidget->getPixMap());
|
_printPreviewForm->setPixmap(_centralWidget->getPixMap());
|
||||||
_printPreviewForm->_customPrintPreviewDialog->showMaximized();
|
// _printPreviewForm->_customPrintPreviewDialog->showMaximized();
|
||||||
|
// _printPreviewForm->setOrientation();
|
||||||
|
|
||||||
|
_printPreviewForm->_customPrintPreviewDialog->exec();
|
||||||
|
_printPreviewForm->_customPrintPreviewDialog->update(); // 可选,强制刷新
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionOnsetTemperaturePoint_triggered() {
|
void MainWindow::on_actionOnsetTemperaturePoint_triggered() {
|
||||||
|
|||||||
@ -6,76 +6,81 @@
|
|||||||
#include "filemanager.h"
|
#include "filemanager.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
LeftWidget::LeftWidget(QWidget *parent ):
|
LeftWidget::LeftWidget(QWidget *parent) : QDockWidget(parent) {
|
||||||
QDockWidget(parent)
|
setWindowTitle("文件浏览");
|
||||||
{
|
|
||||||
// setStyleSheet("background-color: yellow;");
|
|
||||||
|
|
||||||
_treeWidget = new QTreeWidget();
|
_treeWidget = new QTreeWidget();
|
||||||
_treeWidget->setHeaderHidden(true);
|
_treeWidget->setHeaderHidden(true);
|
||||||
|
|
||||||
_sampleDataItem = new QTreeWidgetItem(_treeWidget);
|
_sampleDataItem = new QTreeWidgetItem(_treeWidget);
|
||||||
_sampleDataItem->setText(0,"样品数据");
|
_sampleDataItem->setText(0, "样品数据");
|
||||||
#if 0
|
#if 0
|
||||||
_baseLineItem = new QTreeWidgetItem(_treeWidget);
|
_baseLineItem = new QTreeWidgetItem(_treeWidget);
|
||||||
_baseLineItem->setText(0,"基线");
|
_baseLineItem->setText(0,"基线");
|
||||||
#endif
|
#endif
|
||||||
_analysisStateItem = new QTreeWidgetItem(_treeWidget);
|
_analysisStateItem = new QTreeWidgetItem(_treeWidget);
|
||||||
_analysisStateItem->setText(0,"分析状态");
|
_analysisStateItem->setText(0, "分析状态");
|
||||||
|
|
||||||
_treeWidget->setSortingEnabled(false);
|
_treeWidget->setSortingEnabled(false);
|
||||||
|
|
||||||
_treeWidget->insertTopLevelItem(0, _sampleDataItem);
|
_treeWidget->insertTopLevelItem(0, _sampleDataItem);
|
||||||
// _treeWidget->insertTopLevelItem(1, _baseLineItem);
|
// _treeWidget->insertTopLevelItem(1, _baseLineItem);
|
||||||
_treeWidget->insertTopLevelItem(2, _analysisStateItem);
|
_treeWidget->insertTopLevelItem(2, _analysisStateItem);
|
||||||
|
|
||||||
setWidget(_treeWidget);
|
setWidget(_treeWidget);
|
||||||
|
|
||||||
//init file name.
|
// init file name.
|
||||||
initFileName(_sampleDataItem,Global::SampleDataFloder);
|
initFileName(_sampleDataItem, Global::SampleDataFloder);
|
||||||
#if 0
|
#if 0
|
||||||
initFileName(_baseLineItem,Global::BaseLineFolder);
|
initFileName(_baseLineItem,Global::BaseLineFolder);
|
||||||
#endif
|
#endif
|
||||||
initFileName(_analysisStateItem,Global::AnalysisStateFolder);
|
initFileName(_analysisStateItem, Global::AnalysisStateFolder);
|
||||||
|
|
||||||
expandAll(_sampleDataItem);
|
expandAll(_sampleDataItem);
|
||||||
// expandAll(_baseLineItem);
|
// expandAll(_baseLineItem);
|
||||||
expandAll(_analysisStateItem);
|
expandAll(_analysisStateItem);
|
||||||
|
|
||||||
Global::updateFileList();
|
Global::updateFileList();
|
||||||
|
|
||||||
|
|
||||||
//connections
|
// connections
|
||||||
connect(_treeWidget,&QTreeWidget::itemDoubleClicked,
|
connect(_treeWidget, &QTreeWidget::itemDoubleClicked,
|
||||||
this,&LeftWidget::slotTreeWidgetItemClicked);
|
this, &LeftWidget::slotTreeWidgetItemClicked);
|
||||||
|
|
||||||
|
// 右键菜单
|
||||||
|
_contextMenu = new QMenu(_treeWidget);
|
||||||
|
_deleteAction = new QAction("删除", this);
|
||||||
|
_contextMenu->addAction(_deleteAction);
|
||||||
|
|
||||||
|
_treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(_treeWidget, &QTreeWidget::customContextMenuRequested,
|
||||||
|
this, &LeftWidget::slotShowContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeftWidget::reloadFileName()
|
void LeftWidget::reloadFileName() {
|
||||||
{
|
|
||||||
clearAllChildItems(_sampleDataItem);
|
clearAllChildItems(_sampleDataItem);
|
||||||
clearAllChildItems(_baseLineItem);
|
// clearAllChildItems(_baseLineItem);
|
||||||
clearAllChildItems(_analysisStateItem);
|
clearAllChildItems(_analysisStateItem);
|
||||||
|
|
||||||
initFileName(_sampleDataItem,Global::SampleDataFloder);
|
initFileName(_sampleDataItem, Global::SampleDataFloder);
|
||||||
#if 0
|
#if 0
|
||||||
initFileName(_baseLineItem,Global::BaseLineFolder);
|
initFileName(_baseLineItem,Global::BaseLineFolder);
|
||||||
#endif
|
#endif
|
||||||
initFileName(_analysisStateItem,Global::AnalysisStateFolder);
|
initFileName(_analysisStateItem, Global::AnalysisStateFolder);
|
||||||
// 更新文件列表
|
// 更新文件列表
|
||||||
Global::updateFileList();
|
Global::updateFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LeftWidget::filePathCheck(const QString fileName,const QString folderPath)
|
QString LeftWidget::filePathCheck(const QString fileName, const QString folderPath) {
|
||||||
{
|
|
||||||
QString resultFileName = fileName;
|
QString resultFileName = fileName;
|
||||||
|
|
||||||
QDir dir(folderPath);
|
QDir dir(folderPath);
|
||||||
QStringList files = dir.entryList(QDir::Files);
|
QStringList files = dir.entryList(QDir::Files);
|
||||||
for(const QString &existedFileName:files){
|
for (const QString &existedFileName : files) {
|
||||||
QFileInfo fileInfo(existedFileName);
|
QFileInfo fileInfo(existedFileName);
|
||||||
if(fileName == fileInfo.baseName()){
|
if (fileName == fileInfo.baseName()) {
|
||||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||||
QString formattedTime = currentDateTime.toString("yyyy_MM_dd_HH_mm_ss");
|
QString formattedTime = currentDateTime.toString("yyyy_MM_dd_HH_mm_ss");
|
||||||
|
|
||||||
resultFileName = fileName + QString("_") + formattedTime;
|
resultFileName = fileName + QString("_") + formattedTime;
|
||||||
break;
|
break;
|
||||||
@ -85,8 +90,7 @@ QString LeftWidget::filePathCheck(const QString fileName,const QString folderPat
|
|||||||
return resultFileName;
|
return resultFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeftWidget::initData()
|
void LeftWidget::initData() {
|
||||||
{
|
|
||||||
// const QString folderPath = QDir::currentPath()+"/../experiment_data";
|
// const QString folderPath = QDir::currentPath()+"/../experiment_data";
|
||||||
const QString folderPath = Global::SampleDataFloder;
|
const QString folderPath = Global::SampleDataFloder;
|
||||||
#if 1
|
#if 1
|
||||||
@ -98,7 +102,7 @@ void LeftWidget::initData()
|
|||||||
|
|
||||||
// 遍历文件
|
// 遍历文件
|
||||||
QFileInfoList fileList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
QFileInfoList fileList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
for (const QFileInfo& fileInfo : fileList) {
|
for (const QFileInfo &fileInfo : fileList) {
|
||||||
QFile file(fileInfo.absoluteFilePath());
|
QFile file(fileInfo.absoluteFilePath());
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
QString content = file.readAll();
|
QString content = file.readAll();
|
||||||
@ -118,10 +122,10 @@ void LeftWidget::initData()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void LeftWidget::slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column){
|
void LeftWidget::slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column) {
|
||||||
qDebug()<<"item clicked:"<<item->text(0)<<column;
|
qDebug() << "item clicked:" << item->text(0) << column;
|
||||||
|
|
||||||
if(Global::Mode::Analysis != Global::_mode){
|
if (Global::Mode::Analysis != Global::_mode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,14 +134,14 @@ void LeftWidget::slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column){
|
|||||||
QTreeWidgetItem *parentItem = item->parent();
|
QTreeWidgetItem *parentItem = item->parent();
|
||||||
if (parentItem) {
|
if (parentItem) {
|
||||||
qDebug() << "parent item text:" << parentItem->text(0);
|
qDebug() << "parent item text:" << parentItem->text(0);
|
||||||
if(parentItem == _sampleDataItem){
|
if (parentItem == _sampleDataItem) {
|
||||||
fileName =Global::SampleDataFloder + "/" + item->text(0);
|
fileName = Global::SampleDataFloder + "/" + item->text(0);
|
||||||
#if 0
|
#if 0
|
||||||
}else if(parentItem == _baseLineItem){
|
}else if(parentItem == _baseLineItem){
|
||||||
fileName =Global::BaseLineFolder + "/" +item->text(0);
|
fileName =Global::BaseLineFolder + "/" +item->text(0);
|
||||||
#endif
|
#endif
|
||||||
}else if(parentItem == _analysisStateItem){
|
} else if (parentItem == _analysisStateItem) {
|
||||||
fileName =Global::AnalysisStateFolder + "/" +item->text(0);
|
fileName = Global::AnalysisStateFolder + "/" + item->text(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "item has no parent (it is a top-level item)";
|
qDebug() << "item has no parent (it is a top-level item)";
|
||||||
@ -146,30 +150,28 @@ void LeftWidget::slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column){
|
|||||||
|
|
||||||
emit sigSendAnalysisFileName(fileName);
|
emit sigSendAnalysisFileName(fileName);
|
||||||
}
|
}
|
||||||
void LeftWidget::initFileName(QTreeWidgetItem* parentItem,const QString &folderPath)
|
void LeftWidget::initFileName(QTreeWidgetItem *parentItem, const QString &folderPath) {
|
||||||
{
|
QDir dir(folderPath);
|
||||||
QDir dir(folderPath);
|
|
||||||
QStringList files = dir.entryList(QDir::Files);
|
QStringList files = dir.entryList(QDir::Files);
|
||||||
for(const QString &fileName:files){
|
for (const QString &fileName : files) {
|
||||||
QTreeWidgetItem *subItem = new QTreeWidgetItem();
|
QTreeWidgetItem *subItem = new QTreeWidgetItem();
|
||||||
subItem->setText(0,fileName);
|
subItem->setText(0, fileName);
|
||||||
// _sampleDataItem->addChild(new QTreeWidgetItem(0,fileName));
|
subItem->setData(0, Qt::UserRole, QVariant::fromValue(folderPath + "/" + fileName));
|
||||||
parentItem->addChild(subItem);
|
parentItem->addChild(subItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeftWidget::expandAll(QTreeWidgetItem* item) {
|
void LeftWidget::expandAll(QTreeWidgetItem *item) {
|
||||||
item->setExpanded(true);
|
item->setExpanded(true);
|
||||||
for (int i = 0; i < item->childCount(); ++i) {
|
for (int i = 0; i < item->childCount(); ++i) {
|
||||||
expandAll(item->child(i));
|
expandAll(item->child(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeftWidget::clearAllChildItems(QTreeWidgetItem *parentItem)
|
void LeftWidget::clearAllChildItems(QTreeWidgetItem *parentItem) {
|
||||||
{
|
|
||||||
int childCount = parentItem->childCount();
|
int childCount = parentItem->childCount();
|
||||||
for (int i = 0; i < childCount; ++i) {
|
for (int i = 0; i < childCount; ++i) {
|
||||||
QTreeWidgetItem* childItem = parentItem->takeChild(0);
|
QTreeWidgetItem *childItem = parentItem->takeChild(0);
|
||||||
delete childItem;
|
delete childItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,4 +215,26 @@ void LeftWidget::recursiveFolderOperation(const QString& folderPath) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void LeftWidget::slotShowContextMenu(const QPoint &pos) {
|
||||||
|
QPoint globalPos = _treeWidget->mapToGlobal(pos);
|
||||||
|
_contextMenu->exec(globalPos);
|
||||||
|
|
||||||
|
// 获取当前选中的项
|
||||||
|
QTreeWidgetItem *currentItem = _treeWidget->itemAt(pos);
|
||||||
|
if (currentItem == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString filePath = currentItem->data(0, Qt::UserRole).toString();
|
||||||
|
if (filePath.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// qDebug() << "file:" << filePath;
|
||||||
|
if (QFile::remove(filePath)) {
|
||||||
|
qDebug() << "文件删除成功:" << filePath;
|
||||||
|
} else {
|
||||||
|
qWarning() << "文件删除失败:" << filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
reloadFileName();
|
||||||
|
}
|
||||||
|
|||||||
@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
#include <qmenu.h>
|
||||||
#include <qtreewidget.h>
|
#include <qtreewidget.h>
|
||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
@ -24,8 +27,10 @@ private:
|
|||||||
void initFileName(QTreeWidgetItem*,const QString &folderPath);
|
void initFileName(QTreeWidgetItem*,const QString &folderPath);
|
||||||
void expandAll(QTreeWidgetItem* item);
|
void expandAll(QTreeWidgetItem* item);
|
||||||
void clearAllChildItems(QTreeWidgetItem* parentItem);
|
void clearAllChildItems(QTreeWidgetItem* parentItem);
|
||||||
|
void removeFile(const QString& filePath);
|
||||||
private slots:
|
private slots:
|
||||||
void slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column);
|
void slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column);
|
||||||
|
void slotShowContextMenu(const QPoint &pos);
|
||||||
private:
|
private:
|
||||||
QTreeWidget *_treeWidget;
|
QTreeWidget *_treeWidget;
|
||||||
|
|
||||||
@ -33,7 +38,8 @@ private:
|
|||||||
*_baseLineItem,
|
*_baseLineItem,
|
||||||
*_sampleDataItem;
|
*_sampleDataItem;
|
||||||
|
|
||||||
|
QMenu *_contextMenu;
|
||||||
|
QAction *_deleteAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEFTWIDGET_H
|
#endif // LEFTWIDGET_H
|
||||||
|
|||||||
@ -6,46 +6,71 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
PrintPreviewForm::PrintPreviewForm(QWidget *parent) :
|
PrintPreviewForm::PrintPreviewForm(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
ui(new Ui::PrintPreviewForm),
|
||||||
ui(new Ui::PrintPreviewForm)
|
_printer(new QPrinter(QPrinter::HighResolution)) {
|
||||||
,_printer(new QPrinter(QPrinter::HighResolution))
|
|
||||||
// ,_customPrintPreviewDialog(new QPrintPreviewDialog(_printer,this))
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
_printer->setPageSize(QPageSize(QPageSize::A4));
|
_printer->setPageSize(QPageSize(QPageSize::A4));
|
||||||
_printer->setOrientation(QPrinter::Landscape);
|
_printer->setOrientation(QPrinter::Landscape);
|
||||||
|
// _printer->setOutputFormat(QPrinter::NativeFormat); // 关键
|
||||||
|
|
||||||
_customPrintPreviewDialog = new QPrintPreviewDialog(_printer,this);
|
_customPrintPreviewDialog = new QPrintPreviewDialog(_printer, this);
|
||||||
|
|
||||||
QObject::connect(_customPrintPreviewDialog, &QPrintPreviewDialog::paintRequested,
|
|
||||||
this,&PrintPreviewForm::slotPaintRequested);
|
|
||||||
|
|
||||||
_customPrintPreviewDialog->setWindowFlags(_customPrintPreviewDialog->windowFlags()
|
_customPrintPreviewDialog->setWindowFlags(_customPrintPreviewDialog->windowFlags()
|
||||||
| Qt::WindowMaximizeButtonHint
|
| Qt::WindowMaximizeButtonHint
|
||||||
| Qt::WindowMinimizeButtonHint);
|
| Qt::WindowMinimizeButtonHint);
|
||||||
|
|
||||||
|
// _painter = new QPainter(_printer);
|
||||||
|
|
||||||
|
QObject::connect(_customPrintPreviewDialog,
|
||||||
|
&QPrintPreviewDialog::paintRequested,
|
||||||
|
this,
|
||||||
|
&PrintPreviewForm::slotPaintRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintPreviewForm::~PrintPreviewForm()
|
PrintPreviewForm::~PrintPreviewForm() {
|
||||||
{
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintPreviewForm::setPixmap(const QPixmap &pixmap)
|
void PrintPreviewForm::setPixmap(const QPixmap &pixmap) {
|
||||||
{
|
logde << "setPixmap...";
|
||||||
#if 0
|
|
||||||
QPixmap localPixmap = pixmap;
|
|
||||||
localPixmap.scaled(ui->labelPixmap->size());
|
|
||||||
ui->labelPixmap->setPixmap(pixmap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_pixmap = pixmap;
|
_pixmap = pixmap;
|
||||||
|
|
||||||
|
if (!_customPrintPreviewDialog)
|
||||||
|
return;
|
||||||
|
if (auto pv = _customPrintPreviewDialog->findChild<QPrintPreviewWidget *>()) {
|
||||||
|
pv->updatePreview(); // 触发 paintRequested
|
||||||
|
} else {
|
||||||
|
_customPrintPreviewDialog->update(); // 退化处理
|
||||||
|
}
|
||||||
|
|
||||||
|
// repaint();
|
||||||
|
#if 0
|
||||||
|
if (_customPrintPreviewDialog) {
|
||||||
|
_customPrintPreviewDialog->repaint(); // 强制刷新
|
||||||
|
_customPrintPreviewDialog->update(); // 刷新预览窗口
|
||||||
|
|
||||||
|
_printer->setOrientation(
|
||||||
|
_printer->orientation() == QPrinter::Landscape
|
||||||
|
? QPrinter::Portrait
|
||||||
|
: QPrinter::Landscape);
|
||||||
|
|
||||||
|
_printer->setOrientation(QPrinter::Landscape);
|
||||||
|
|
||||||
|
|
||||||
|
_customPrintPreviewDialog->repaint(); // 强制刷新
|
||||||
|
_customPrintPreviewDialog->update(); // 刷新预览窗口
|
||||||
|
// _customPrintPreviewDialog->updatePreview(); // 刷新预览
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// slotPaintRequested(_printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintPreviewForm::slotPaintRequested(QPrinter *printer) {
|
||||||
|
logde << "slotPaintRequested...";
|
||||||
|
|
||||||
void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|
||||||
{
|
|
||||||
const int ConTextHeight = 100;
|
const int ConTextHeight = 100;
|
||||||
|
|
||||||
printer->setOrientation(QPrinter::Landscape);
|
printer->setOrientation(QPrinter::Landscape);
|
||||||
@ -60,52 +85,42 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// 绘制第一页(不需要先调用 newPage())
|
// 获取页面矩形区域
|
||||||
// painter.drawText(100, 100, "Page 1");
|
|
||||||
|
|
||||||
QRect pageRect = printer->pageRect();
|
QRect pageRect = printer->pageRect();
|
||||||
qDebug()<<"rect:"<<pageRect;
|
|
||||||
|
|
||||||
#if 1
|
// 绘制主框
|
||||||
// 绘制矩形框
|
|
||||||
QRect frameRect(50, 50, pageRect.width() - 100, pageRect.height() - 100);
|
QRect frameRect(50, 50, pageRect.width() - 100, pageRect.height() - 100);
|
||||||
QPen pen(Qt::black, 1); // 设置笔的宽度和颜色
|
QPen pen(Qt::black, 1); // 设置笔的宽度和颜色
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
painter.drawRect(frameRect);
|
painter.drawRect(frameRect);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Draw image.
|
// 绘制图像区域
|
||||||
QRect imageRect = frameRect;
|
QRect imageRect = frameRect;
|
||||||
imageRect.setHeight(imageRect.height() - ConTextHeight * 7);
|
imageRect.setHeight(imageRect.height() - ConTextHeight * 7);
|
||||||
|
|
||||||
if (!_pixmap.isNull()) {
|
if (!_pixmap.isNull()) {
|
||||||
QPixmap resizedPixmap =
|
QPixmap resizedPixmap =
|
||||||
_pixmap.scaled(imageRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
_pixmap.scaled(imageRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
painter.drawPixmap(imageRect, resizedPixmap);
|
painter.drawPixmap(imageRect, resizedPixmap);
|
||||||
}else{
|
} else {
|
||||||
logde<<"piamap is null.";
|
logde << "pixmap is null.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// file info
|
// 绘制文件信息区域
|
||||||
QRect fileInfoRect(frameRect.x(),
|
QRect fileInfoRect(frameRect.x(),
|
||||||
frameRect.y() + imageRect.height(),
|
frameRect.y() + imageRect.height(),
|
||||||
frameRect.width(),
|
frameRect.width(),
|
||||||
ConTextHeight);
|
ConTextHeight);
|
||||||
painter.drawRect(fileInfoRect);
|
painter.drawRect(fileInfoRect);
|
||||||
|
|
||||||
QString fileName = Global::getFileName(Global::_curveFileDataVtr.first().filePath);
|
QString fileName = Global::getFileName(Global::_curveFileDataVtr.first().filePath);
|
||||||
QString fileInfoStr = QString(" 设备:差式扫描量热仪 文件名:") + fileName;
|
QString fileInfoStr = QString(" 设备:差式扫描量热仪 文件名:") + fileName;
|
||||||
|
|
||||||
painter.drawText(fileInfoRect, Qt::AlignLeft|Qt::AlignVCenter, fileInfoStr);
|
painter.drawText(fileInfoRect,
|
||||||
|
Qt::AlignLeft | Qt::AlignVCenter,
|
||||||
|
fileInfoStr);
|
||||||
|
|
||||||
// Experiment info.
|
// 绘制实验信息区域
|
||||||
// Only print the first experiment data.
|
|
||||||
#if 0
|
|
||||||
QRect experimentRect(frameRect.x(),
|
|
||||||
fileInfoRect.y() + fileInfoRect.height(),
|
|
||||||
1000,
|
|
||||||
frameRect.height() - imageRect.height() - fileInfoRect.height());
|
|
||||||
#endif
|
|
||||||
QRect experimentRect(frameRect.x(),
|
QRect experimentRect(frameRect.x(),
|
||||||
fileInfoRect.y() + fileInfoRect.height(),
|
fileInfoRect.y() + fileInfoRect.height(),
|
||||||
2000,
|
2000,
|
||||||
@ -114,74 +129,70 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
painter.drawRect(experimentRect);
|
painter.drawRect(experimentRect);
|
||||||
|
|
||||||
Global::ExperimentInfo exInfo = Global::_curveFileDataVtr.first().ei;
|
Global::ExperimentInfo exInfo = Global::_curveFileDataVtr.first().ei;
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
if (Global::_curveFileDataVtr.empty()) {
|
||||||
exInfo = Global::_experimentInfo;
|
exInfo = Global::_experimentInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString experimentInfoStr = QString(" 样品名称:%1 \n"
|
QString experimentInfoStr = QString(" 样品名称:%1 \n"
|
||||||
" 样品重量:%2 mg\n"
|
" 样品重量:%2 mg\n"
|
||||||
" 实验日期:%3 \n"
|
" 实验日期:%3 \n"
|
||||||
" 实验人员:%4 \n"
|
" 实验人员:%4 \n")
|
||||||
)
|
.arg(exInfo.sampleName)
|
||||||
.arg(exInfo.sampleName)
|
.arg(exInfo.sampleWeight)
|
||||||
.arg(exInfo.sampleWeight)
|
.arg(exInfo.date)
|
||||||
.arg(exInfo.date)
|
.arg(exInfo.experimentor);
|
||||||
.arg(exInfo.experimentor);
|
painter.drawText(experimentRect, Qt::AlignLeft | Qt::AlignTop, experimentInfoStr);
|
||||||
painter.drawText(experimentRect, Qt::AlignLeft|Qt::AlignTop, experimentInfoStr);
|
|
||||||
|
|
||||||
// Phase info.
|
// 绘制阶段信息
|
||||||
QRect phaseInfoRect(experimentRect.x() + experimentRect.width()
|
QRect phaseInfoRect(experimentRect.x() + experimentRect.width(), experimentRect.y(),
|
||||||
,experimentRect.y(),
|
|
||||||
frameRect.width() - experimentRect.width(),
|
frameRect.width() - experimentRect.width(),
|
||||||
experimentRect.height());
|
experimentRect.height());
|
||||||
|
|
||||||
QVector<Global::PhaseTotalInfo>& phaseTotalVtr
|
QVector<Global::PhaseTotalInfo> &phaseTotalVtr = Global::_curveFileDataVtr.first().phaseTotalVtr;
|
||||||
= Global::_curveFileDataVtr.first().phaseTotalVtr;
|
|
||||||
|
|
||||||
logde<<"phaseTotalVtr size:"<<phaseTotalVtr.size();
|
logde << "phaseTotalVtr size:" << phaseTotalVtr.size();
|
||||||
|
|
||||||
|
|
||||||
QMap<int,Phase> phaseMap;
|
QMap<int, Phase> phaseMap;
|
||||||
|
|
||||||
for(Global::PhaseTotalInfo& ptInfo:phaseTotalVtr){
|
for (Global::PhaseTotalInfo &ptInfo : phaseTotalVtr) {
|
||||||
phaseMap.insert(ptInfo.phaseIndex,ptInfo.phase);
|
phaseMap.insert(ptInfo.phaseIndex, ptInfo.phase);
|
||||||
logde<<"cutoff temp:"<<ptInfo.phase.cutoff_temp;
|
logde << "cutoff temp:" << ptInfo.phase.cutoff_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString phaseInfoStr;
|
QString phaseInfoStr;
|
||||||
for (auto it = phaseMap.constBegin(); it != phaseMap.constEnd(); ++it) {
|
for (auto it = phaseMap.constBegin(); it != phaseMap.constEnd(); ++it) {
|
||||||
logde << "Key:" << it.key() << ", Onoff:" << it.value().onoff;
|
logde << "Key:" << it.key() << ", Onoff:" << it.value().onoff;
|
||||||
|
|
||||||
if(!it.value().onoff){
|
if (!it.value().onoff) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gasName;
|
QString gasName;
|
||||||
switch(it.value().gas){
|
switch (it.value().gas) {
|
||||||
case GasType::NC:
|
case GasType::NC:
|
||||||
gasName = "NC";
|
gasName = "NC";
|
||||||
break;
|
break;
|
||||||
case GasType::N2:
|
case GasType::N2:
|
||||||
gasName = "N2";
|
gasName = "N2";
|
||||||
break;
|
break;
|
||||||
case GasType::O2:
|
case GasType::O2:
|
||||||
gasName = "O2";
|
gasName = "O2";
|
||||||
break;
|
break;
|
||||||
default:break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
phaseInfoStr.append(QString("阶段:%1 截止温度:%2 扫描速率:%3 恒温时间:%4 气氛:%5 \n")
|
phaseInfoStr.append(QString("阶段:%1 截止温度:%2 扫描速率:%3 恒温时间:%4 气氛:%5 \n")
|
||||||
.arg(QString::number(it.key()))
|
.arg(QString::number(it.key()))
|
||||||
.arg(QString::number(it.value().cutoff_temp,'f',3))
|
.arg(QString::number(it.value().cutoff_temp, 'f', 3))
|
||||||
.arg(QString::number(it.value().temp_flow,'f',3))
|
.arg(QString::number(it.value().temp_flow, 'f', 3))
|
||||||
.arg(QString::number(it.value().constant_temp_time_min,'f',3))
|
.arg(QString::number(it.value().constant_temp_time_min, 'f', 3))
|
||||||
.arg(gasName)
|
.arg(gasName));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
painter.drawText(phaseInfoRect, Qt::AlignLeft|Qt::AlignTop, phaseInfoStr);
|
painter.drawText(phaseInfoRect,
|
||||||
|
Qt::AlignLeft | Qt::AlignTop,
|
||||||
|
phaseInfoStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,11 +6,10 @@
|
|||||||
#include <QPrintPreviewDialog>
|
#include <QPrintPreviewDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class PrintPreviewForm;
|
class PrintPreviewForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrintPreviewForm : public QWidget
|
class PrintPreviewForm : public QWidget {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -19,13 +18,14 @@ public:
|
|||||||
|
|
||||||
void setPixmap(const QPixmap &);
|
void setPixmap(const QPixmap &);
|
||||||
|
|
||||||
QPrintPreviewDialog* _customPrintPreviewDialog;
|
QPrintPreviewDialog *_customPrintPreviewDialog;
|
||||||
private slots:
|
private slots:
|
||||||
void slotPaintRequested(QPrinter *printer);
|
void slotPaintRequested(QPrinter *printer);
|
||||||
private:
|
private:
|
||||||
Ui::PrintPreviewForm *ui;
|
Ui::PrintPreviewForm *ui;
|
||||||
QPrinter * _printer;
|
QPrinter *_printer;
|
||||||
QPixmap _pixmap;
|
QPixmap _pixmap;
|
||||||
|
QPainter *_painter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRINTPREVIEWFORM_H
|
#endif // PRINTPREVIEWFORM_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user