diff --git a/Printsetting.cpp b/Printsetting.cpp
index d74848d..c8cd07b 100644
--- a/Printsetting.cpp
+++ b/Printsetting.cpp
@@ -814,7 +814,8 @@ void PrintSettingModel::applyToSysPara(const PrintSettingModel &model, SysPara *
{
// 喷印风格相关
sysPara->para.leftRightInverse = model.leftRightInverse;
- sysPara->para.upDownInverse = model.upDownInverse;
+ //韩国反馈以左下方第一个点阵位置为 Y:1 X:1 也是离回收管最近的墨点位置
+ sysPara->para.upDownInverse = !model.upDownInverse;
sysPara->para.currSelectVolPara = model.volParaIndex;
sysPara->para.printColDelay = model.printColDelay;
sysPara->para.HighVoltageAmplitude = model.highVoltageAmplitude;
@@ -900,7 +901,8 @@ PrintSettingModel PrintSettingModel::fromSysPara(SysPara *sysPara)
return model;
model.leftRightInverse = sysPara->para.leftRightInverse;
- model.upDownInverse = sysPara->para.upDownInverse;
+ //韩国反馈以左下方第一个点阵位置为 Y:1 X:1 也是离回收管最近的墨点位置
+ model.upDownInverse = !sysPara->para.upDownInverse;
model.mode0211 = sysPara->para.mode0211;
model.printColDelay = sysPara->para.printColDelay;
model.highVoltageAmplitude = sysPara->para.HighVoltageAmplitude;
diff --git a/QtUI.pro b/QtUI.pro
index 1cdb00d..0a80ef8 100644
--- a/QtUI.pro
+++ b/QtUI.pro
@@ -392,4 +392,4 @@ if(contains(DEFINES,__2451WIFI__))
#SOURCES += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/common/wpa_ctrl.c
#INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src
#INCLUDEPATH += /home/student/newDisk/2451_linux/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/src/utils
-}
\ No newline at end of file
+}
diff --git a/TestPrintWidget.ui b/TestPrintWidget.ui
index 0ce803f..a2de2db 100644
--- a/TestPrintWidget.ui
+++ b/TestPrintWidget.ui
@@ -845,17 +845,46 @@
0
-
-
+
+
+
+ 0
+ 170
+
+
+
+ QGraphicsView QScrollBar:horizontal {
+ height: 28px; /* 水平滚动条高度,调大方便拖拽 */
+ background: #f0f0f0; /* 轨道背景色(可自行调整) */
+}
+
+QGraphicsView QScrollBar::handle:horizontal {
+ background: #b0b0b0; /* 滑块颜色 */
+ min-width: 60px; /* 滑块最小宽度,防止太小 */
+ border-radius: 6px;
+}
+
+
+
+ Qt::ScrollBarAlwaysOn
+
+
-
+
+
+ 0
+ 0
+
+
16777215
- 190
+ 150
@@ -880,13 +909,25 @@
-
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 30
+
+
- QLineEdit {
+ QLineEdit {
background-color: #e5e5e5;
border: 1px solid #a8a8a8;
border-radius: 2px;
- padding: 4px 8px;
- min-height: 32px;
+ /*padding: 4px 8px;
+ min-height: 32px;*/
font-size: 16px;
}
@@ -897,6 +938,12 @@
-
+
+
+ 16777215
+ 34
+
+
QPushButton {
background-color: #e5e5e5;
@@ -921,6 +968,12 @@
-
+
+
+ 16777215
+ 34
+
+
QPushButton {
background-color: #e5e5e5;
@@ -960,6 +1013,12 @@
-
+
+
+ 16777215
+ 88
+
+
QLabel {
background-color: #e5e5e5;
@@ -978,6 +1037,12 @@
-
+
+
+ 16777215
+ 100
+
+
QLabel {
background-color: #e5e5e5;
@@ -999,31 +1064,6 @@
4
-
-
-
-
- QPushButton {
- background-color: #87CEEB;
- border: 1px solid #4682B4;
- border-radius: 4px;
- min-width: 40px;
- min-height: 40px;
- font-size: 18px;
- font-weight: bold;
- color: #00008B;
- }
- QPushButton:hover {
- background-color: #ADD8E6;
- }
- QPushButton:pressed {
- background-color: #B0E0E6;
- }
-
-
- ↑
-
-
-
-
@@ -1099,10 +1139,47 @@
+ -
+
+
+ QPushButton {
+ background-color: #87CEEB;
+ border: 1px solid #4682B4;
+ border-radius: 4px;
+ min-width: 40px;
+ min-height: 40px;
+ font-size: 18px;
+ font-weight: bold;
+ color: #00008B;
+ }
+ QPushButton:hover {
+ background-color: #ADD8E6;
+ }
+ QPushButton:pressed {
+ background-color: #B0E0E6;
+ }
+
+
+ ↑
+
+
+
-
+
+
+ 0
+ 35
+
+
+
+
+ 16777215
+ 88
+
+
QLabel {
background-color: #e5e5e5;
@@ -1121,6 +1198,12 @@
-
+
+
+ 62
+ 84
+
+
Ubuntu
@@ -1133,7 +1216,7 @@
border: 1px solid #87CEEB;
border-radius: 4px;
min-width: 60px;
- min-height: 40px;
+ /*min-height: 40px;*/
font-size: 24px;
font-family: "Ubuntu";
color: #228B22;
diff --git a/image.qrc b/image.qrc
index 264c929..ba925cc 100644
--- a/image.qrc
+++ b/image.qrc
@@ -231,7 +231,6 @@
icon/pauseprint1.png
icon/pauseprint2.png
icon/TEXT.PNG
- buge_record.txt
icon/Epauseprint.png
icon/Epauseprint1.png
icon/Epauseprint2.png
diff --git a/mainwidget.cpp b/mainwidget.cpp
index ca3d959..435c7df 100644
--- a/mainwidget.cpp
+++ b/mainwidget.cpp
@@ -699,18 +699,40 @@ QList MainWidget::variableItemsUpdate()
continue;
}
+// const QRectF itemSceneRect = item->sceneBoundingRect();
+// const QRectF itemBufferRect = itemSceneRect.translated(-contentRect.topLeft());
+// const QRectF clippedBufferRect = itemBufferRect.intersected(outputRect);
+// if(clippedBufferRect.isEmpty())
+// continue;
+
+// QRect targetRect = clippedBufferRect.toAlignedRect();
+// totalOfDatetimeNumber++;
+
+// if(targetRect != itemBufferRect.toAlignedRect()) {
+// const int cropX = qMax(0, targetRect.left() - itemBufferRect.toAlignedRect().left());
+// const int cropY = qMax(0, targetRect.top() - itemBufferRect.toAlignedRect().top());
+// img = img.copy(cropX, cropY, targetRect.width(), targetRect.height());
+// ++nbClipDatetimePreview;
+// }
+ // 获取 item 的场景绝对坐标
const QRectF itemSceneRect = item->sceneBoundingRect();
- const QRectF itemBufferRect = itemSceneRect.translated(-contentRect.topLeft());
- const QRectF clippedBufferRect = itemBufferRect.intersected(outputRect);
- if(clippedBufferRect.isEmpty())
+ // 与输出区域裁剪(使用绝对坐标)
+ const QRectF clippedSceneRect = itemSceneRect.intersected(outputRect);
+ if(clippedSceneRect.isEmpty())
continue;
- QRect targetRect = clippedBufferRect.toAlignedRect();
+ QRect targetRect = clippedSceneRect.toAlignedRect();
totalOfDatetimeNumber++;
- if(targetRect != itemBufferRect.toAlignedRect()) {
- const int cropX = qMax(0, targetRect.left() - itemBufferRect.toAlignedRect().left());
- const int cropY = qMax(0, targetRect.top() - itemBufferRect.toAlignedRect().top());
+ // 计算 item 在场景中的绝对矩形(整数对齐)
+ QRect itemSceneAlignedRect = itemSceneRect.toAlignedRect();
+ // 如果 targetRect 和 item 原始场景矩形不一致,说明被 outputRect 裁剪了
+ if(targetRect != itemSceneAlignedRect) {
+ // 计算裁剪偏移量:相对于 item 左上角的偏移
+ const int cropX = targetRect.left() - itemSceneAlignedRect.left();
+ const int cropY = targetRect.top() - itemSceneAlignedRect.top();
+ // 从 preview 图片中裁剪出对应区域
+ // 注意:preview 图片的尺寸等于 itemSceneAlignedRect 的尺寸(假设 preview 生成时使用了完整的 boundingRect)
img = img.copy(cropX, cropY, targetRect.width(), targetRect.height());
++nbClipDatetimePreview;
}
@@ -1976,11 +1998,13 @@ void MainWidget::onPreviewScene()
const QRectF contentRect = pPicScene->itemsBoundingRect();
const QRect sceneRect = contentRect.toAlignedRect();
qDebug() << "sceneRect: " << sceneRect;
-
// 限定最大高度和宽度
- int coldot = qMin(sceneRect.width(), MaxCol4000 ? MAX_PRINT_COL_NUM_Normal : MAX_PRINT_COL_NUM_Wide);
- int maxPicHeight = qMin(sceneRect.height(), int(sysPara->para.canvasHeight));
- QSize size(coldot,maxPicHeight);
+// int coldot = qMin(sceneRect.width(), MaxCol4000 ? MAX_PRINT_COL_NUM_Normal : MAX_PRINT_COL_NUM_Wide);
+// int maxPicHeight = qMin(sceneRect.height(), int(sysPara->para.canvasHeight));
+// QSize size(coldot,maxPicHeight);
+ int coldot = qMin(int(contentRect.right()), MaxCol4000 ? MAX_PRINT_COL_NUM_Normal : MAX_PRINT_COL_NUM_Wide);
+ QSize size(MAX_PRINT_COL_NUM_Normal,sysPara->para.canvasHeight);
+
if(size.isEmpty()) {
//场景为空时,渲染空场景并刷新界面
@@ -2035,9 +2059,12 @@ void MainWidget::onPreviewScene()
if(clippedSceneRect.isEmpty())
continue;
- const QRect itemRect = clippedSceneRect.translated(-contentRect.topLeft()).toAlignedRect();
+ // const QRect itemRect = clippedSceneRect.translated(-contentRect.topLeft()).toAlignedRect();
+ // 直接使用场景绝对坐标,不进行平移
+ const QRect itemRect = clippedSceneRect.toAlignedRect();
const QRectF sourceRect = clippedSceneRect;
+
if(picText && picText->sourceType() == SourceType::COUNTER) {
PicCounterItem* counterItem = qgraphicsitem_cast(picText);
if(!counterItem)
@@ -2075,8 +2102,8 @@ void MainWidget::onPreviewScene()
pPicScene->render(&painter, itemRect, sourceRect);
}
- sysPara->status.currPrintRow = sceneRect.height();
- sysPara->status.currPrintCol = sceneRect.width();
+ sysPara->status.currPrintRow = contentRect.bottom();
+ sysPara->status.currPrintCol = contentRect.right();
imageToPrintData(image, 0, 0);
diff --git a/testprintwidget.cpp b/testprintwidget.cpp
index bc89783..724764c 100644
--- a/testprintwidget.cpp
+++ b/testprintwidget.cpp
@@ -31,6 +31,7 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
// m_TextEdit = ui.m_TextEdit;
m_LineEdit = ui.m_LineEdit;
pViewer = ui.graphicsView;
+
// 初始化按钮组(互斥)
m_ButtonGroup = new QButtonGroup(this);
m_ButtonGroup->setExclusive(true);
@@ -427,6 +428,7 @@ void TestPrintWidget::openWorkFile(QString filePath){
// 将场景中所有项移动,使 pPicScene->itemsBoundingRect() 的左上角对齐到 scene 的 (0,0)
// 计算当前边界并做平移(仅在有偏移时执行)
+ /*
QRectF bounds = pPicScene->itemsBoundingRect();
if (!bounds.isNull()) {
qreal dx = -bounds.x();
@@ -440,7 +442,8 @@ void TestPrintWidget::openWorkFile(QString filePath){
it->setPos(oldPos + QPointF(dx, dy));
}
}
- }
+ }
+ */
pViewer->centerOn(0, 0);
@@ -1129,4 +1132,4 @@ void TestPrintWidget::on_btn_copy_clicked()
void TestPrintWidget::on_btn_paste_clicked()
{
pasteCopiedLayer();
-}
\ No newline at end of file
+}