2026年6月22日 :大量更新
This commit is contained in:
+57
-27
@@ -43,10 +43,6 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
// 加载UI文件
|
||||
ui.setupUi(this);
|
||||
|
||||
if (sysPara == nullptr) {
|
||||
sysPara = SysPara::ins();
|
||||
}
|
||||
|
||||
// 关联成员变量到UI控件
|
||||
m_EditBtn = ui.m_EditBtn;
|
||||
m_AddBtn = ui.m_AddBtn;
|
||||
@@ -125,6 +121,7 @@ void MainWidget::init()
|
||||
m_setNumDlg = new SetNumDlg(this);
|
||||
}
|
||||
connect(m_setNumDlg, &SetNumDlg::sig_setNum, this, &MainWidget::slt_setNum);
|
||||
connect(m_setNumDlg, &SetNumDlg::sig_clearCnt, this, &MainWidget::slt_clearCnt);
|
||||
}
|
||||
|
||||
void MainWidget::buttonClickedSlot()
|
||||
@@ -174,6 +171,21 @@ void MainWidget::bindPicScene(PicScene* pPicScene){
|
||||
this->pPicScene = pPicScene;
|
||||
}
|
||||
|
||||
void MainWidget::bindSysPara(SysPara *sysPara){
|
||||
this->sysPara = sysPara;
|
||||
// ui->textEditOption->bindSysPara(sysPara);
|
||||
m_PrintDisplay->bindSysPara(sysPara);
|
||||
#ifdef _2DCODE_
|
||||
// barcode->bindSysPara(sysPara);
|
||||
// dlgqrcode->setSysPara(sysPara);
|
||||
// dlgqrcode->barCodeFlag = this->sysPara->para.qrOption.barCodeFlag;
|
||||
// dlgqrcode->SetOption((qrOption_t*)&sysPara->para.qrOption);
|
||||
#endif
|
||||
#ifdef PICSCENE
|
||||
// ui->senceEditOption->bindSysPara(sysPara);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWidget::_on_pushButtonPowerOff_pressed(bool notice)
|
||||
{
|
||||
if(!sysPara)
|
||||
@@ -1063,7 +1075,7 @@ void MainWidget::generateCharRamData()
|
||||
else
|
||||
width = (p_var->digitalNum)?(10*(p_var->width/p_var->digitalNum)):12;
|
||||
int width2 = width;//+(sysPara->status.addSpace?width:0);
|
||||
int height = Public::derivePixelSizeFromHeight(p_var->height);
|
||||
int height = p_var->height;
|
||||
|
||||
textEdit.clear();
|
||||
int DPI = textEdit.logicalDpiX();
|
||||
@@ -1422,7 +1434,8 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
if(!codeItem)
|
||||
continue;
|
||||
|
||||
QVector<int> counterValus{sysPara->para.cnt1CurrValue, sysPara->para.cnt2CurrValue};
|
||||
QVector<int> counterValus{QString::number(sysPara->status.calandar_and_dat.cnt1CurrValue,16).toInt(),
|
||||
QString::number(sysPara->status.calandar_and_dat.cnt2CurrValue,16).toInt()};
|
||||
auto b = codeItem->updateVariants(counterValus);
|
||||
isUpdate |= b;
|
||||
if(!b)
|
||||
@@ -1435,14 +1448,14 @@ bool MainWidget::dateTimeItemsDotUpdate()
|
||||
continue;
|
||||
}
|
||||
|
||||
auto sceneRect = pPicScene->sceneRect();
|
||||
auto boundingRect = pPicScene->itemsBoundingRect();
|
||||
QRectF itemRect(item->pos() - boundingRect.topLeft(), img.size());
|
||||
auto sceneRect = pPicScene->sceneRect().toRect();
|
||||
auto boundingRect = pPicScene->itemsBoundingRect().toRect();
|
||||
QRect itemRect(item->pos().x() - boundingRect.x(), item->pos().y() - boundingRect.y(), img.width(), img.height());
|
||||
totalOfDatetimeNumber++;
|
||||
|
||||
// 裁剪item位置, 确保item位于场景内
|
||||
// 如果item超出了场景范围,则裁剪img并更新itemRect,只显示场景内的部分
|
||||
QRectF intersectRect = itemRect.intersected(sceneRect);
|
||||
QRect intersectRect = itemRect.intersected(sceneRect);
|
||||
|
||||
if(!intersectRect.isEmpty() && intersectRect != itemRect) {
|
||||
// 计算裁剪区域在原图中的偏移
|
||||
@@ -1538,7 +1551,9 @@ void MainWidget::updateTotalCnt(int en)
|
||||
// ui.labelTotalProductCnt->setText(QString::number( sysPara->para.totalProductCnt+sysPara->status.totalProductCnt));
|
||||
// 20260410 总数栏改为预设数值栏
|
||||
if (m_setNumDlg->getIsSet() && m_setNumDlg->getNum() > 0 &&
|
||||
ui.labelProductCnt->text() == ui.labelTotalProductCnt->text()) {
|
||||
sysPara->status.productCnt == m_setNumDlg->getNum()) {
|
||||
LogInfo::setRunStatusText(QString("productCnt:%1 setNum:%2")
|
||||
.arg(sysPara->status.productCnt).arg(m_setNumDlg->getNum()));
|
||||
on_m_StopBtn_clicked();
|
||||
}
|
||||
}
|
||||
@@ -1573,8 +1588,8 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
print_len_min = stroke * size.width();
|
||||
if(print_len_min > sysPara->para.synTriggerPrintLenMm && !sysPara->para.charWidthSetEnable)
|
||||
{
|
||||
// QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min));
|
||||
// return;
|
||||
QMessageBox::information(this,tr("错误"),tr("喷印间隔过短,应高于%1!").arg(print_len_min));
|
||||
return;
|
||||
}
|
||||
}
|
||||
/******2020/2/29 end*****/
|
||||
@@ -1656,10 +1671,13 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
printintFlag = true;
|
||||
}
|
||||
|
||||
startPrintingFlag = true;sysPara->status.isPrinting=true;
|
||||
startPrintingFlag = true;
|
||||
sysPara->status.isPrinting=true;
|
||||
|
||||
// 高亮切换
|
||||
changeHighLight(true);
|
||||
|
||||
LogInfo::setRunStatusText("Start print...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1703,17 +1721,23 @@ void MainWidget::on_m_StopBtn_clicked()
|
||||
}
|
||||
// 高亮切换
|
||||
changeHighLight(false);
|
||||
|
||||
LogInfo::setRunStatusText("Stop print...");
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char blankDat1[BLANK_COL_NUM*MAX_PRINT_ROW_BYTE_NUM]={0};
|
||||
void MainWidget::SendPrintDataToFpga(unsigned char alterEnable)
|
||||
void MainWidget::SendPrintDataToFpga(unsigned char alterEnable, bool isUpdate)
|
||||
{
|
||||
if(!sysPara) return ;
|
||||
// fileChange=false;
|
||||
sysPara->devOp->writeFpgaPrintPara(1); /*务必放在最后一步*/
|
||||
sysPara->devOp->writeFpgaVariCtrl();
|
||||
|
||||
Q_UNUSED(alterEnable);
|
||||
|
||||
if(!isUpdate) {
|
||||
sysPara->devOp->writeFpgaPrintPara(1);
|
||||
sysPara->devOp->writeFpgaVariCtrl();
|
||||
}
|
||||
|
||||
sysPara->devOp->fpgaWr(0,blankDat1,sizeof(blankDat1));//...所加的空白偏移地址
|
||||
// 交替打印处理
|
||||
@@ -2092,11 +2116,12 @@ void MainWidget::slt_setNum()
|
||||
ui.labelTotalProductCnt->hide();
|
||||
ui.lb_counter->hide();
|
||||
}
|
||||
}
|
||||
|
||||
// 当前值
|
||||
if (m_setNumDlg->getIsSetCur()) {
|
||||
unsigned int curNum = m_setNumDlg->getCurNum();
|
||||
ui.labelProductCnt->setText(QString::number(curNum));
|
||||
void MainWidget::slt_clearCnt()
|
||||
{
|
||||
if (sysPara) {
|
||||
sysPara->devOp->clearProductCnt(1);//当前产品计数器立即清零
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2321,12 +2346,10 @@ void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
|
||||
if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance)
|
||||
m_RightBtn->setEnabled(false);
|
||||
else if(sysPara->status.selfCheckDone == 1)
|
||||
{
|
||||
m_RightBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
// else if(sysPara->status.selfCheckDone == 1)
|
||||
// {
|
||||
// m_RightBtn->setEnabled(true);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3164,6 +3187,13 @@ void MainWidget::onPreviewScene()
|
||||
/*-------------------------------切换到显示窗口-----------------------------------*/
|
||||
|
||||
qDebug() << "currPrintCol: " << sysPara->status.currPrintCol;
|
||||
LogInfo::setRunStatusText("currPrintCol: " + QString::number(sysPara->status.currPrintCol));
|
||||
LogInfo::setRunStatusText("currPrintRow: " + QString::number(sysPara->status.currPrintRow));
|
||||
LogInfo::setRunStatusText(QString("Items bounding rect: {%1, %2}").arg(pPicScene->itemsBoundingRect().width()).arg(pPicScene->itemsBoundingRect().height()));
|
||||
|
||||
sysPara->status.currPrintRow = pPicScene->itemsBoundingRect().height();
|
||||
sysPara->status.currPrintCol = pPicScene->itemsBoundingRect().width();
|
||||
|
||||
auto rows = sysPara->para.AlterMode?sysPara->status.currAlterPrintRow : sysPara->status.currPrintRow;
|
||||
rows = std::max(rows, (m_PrintDisplay->parentWidget()->height() / m_PrintDisplay->currScaleRatio()));
|
||||
auto cols = sysPara->status.currPrintCol;
|
||||
|
||||
Reference in New Issue
Block a user