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,10 +6,8 @@
|
|||||||
#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);
|
||||||
@ -48,12 +46,20 @@ LeftWidget::LeftWidget(QWidget *parent ):
|
|||||||
// 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);
|
||||||
@ -65,8 +71,7 @@ void LeftWidget::reloadFileName()
|
|||||||
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);
|
||||||
@ -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
|
||||||
@ -146,14 +150,13 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,8 +168,7 @@ void LeftWidget::expandAll(QTreeWidgetItem* item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -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,21 +85,16 @@ 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);
|
||||||
|
|
||||||
@ -83,10 +103,10 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
_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(),
|
||||||
@ -96,16 +116,11 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
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,
|
||||||
@ -121,22 +136,19 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
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();
|
||||||
|
|
||||||
@ -167,7 +179,8 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
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")
|
||||||
@ -175,13 +188,11 @@ void PrintPreviewForm::slotPaintRequested(QPrinter *printer)
|
|||||||
.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,7 @@ namespace Ui {
|
|||||||
class PrintPreviewForm;
|
class PrintPreviewForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrintPreviewForm : public QWidget
|
class PrintPreviewForm : public QWidget {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -26,6 +25,7 @@ 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