2026年6月25日 暂存
This commit is contained in:
+101
-19
@@ -69,8 +69,8 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
|
||||
// ui.labelRunStatus->setWordWrap(true);
|
||||
|
||||
ui.sub3->installEventFilter(this);
|
||||
ui.fra_state->installEventFilter(this);
|
||||
// ui.sub3->installEventFilter(this);
|
||||
// ui.fra_state->installEventFilter(this);
|
||||
ui.labelTotalProductCnt->hide();
|
||||
ui.lb_counter->hide();
|
||||
|
||||
@@ -95,6 +95,8 @@ MainWidget::MainWidget(QWidget* parent)
|
||||
|
||||
scroller->setScrollerProperties(properties);
|
||||
scroller->grabGesture(ui.scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
|
||||
|
||||
connect(ui.btn_newFile, &QPushButton::clicked, this, &MainWidget::newFileAcquired);
|
||||
}
|
||||
|
||||
MainWidget::~MainWidget()
|
||||
@@ -1534,6 +1536,9 @@ void MainWidget::enableReclaimCtrlButton(bool enable){
|
||||
}
|
||||
|
||||
void MainWidget::enablePrintButton(bool enable){
|
||||
#ifdef QT_DEBUG
|
||||
enable = true;
|
||||
#endif
|
||||
m_StartBtn->setEnabled(enable);
|
||||
m_StopBtn->setEnabled(enable);
|
||||
}
|
||||
@@ -1593,6 +1598,7 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
}
|
||||
}
|
||||
/******2020/2/29 end*****/
|
||||
#ifndef QT_DEBUG
|
||||
if(!SIMULATE_PRINTING_MODE){
|
||||
if (!sysPara->status.reclainTankReachEnd) {
|
||||
return;
|
||||
@@ -1606,6 +1612,7 @@ void MainWidget::on_m_StartBtn_clicked()
|
||||
return ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
sysPara->devOp->highVoltageCtrl(1);
|
||||
sysPara->devOp->setHighVoltageAmplitudetoSTM32();
|
||||
@@ -2155,7 +2162,7 @@ void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
unsigned int tmp = ((unsigned int) sysPara->status.synPulseCntPer1s ) & 0xffffff;
|
||||
unsigned int mm = tmp /sysPara->para.synPulseNumPerMm * 60; // 1min总脉冲/毫米脉冲数 = 1min走过的距离mm数
|
||||
int dotNum = sysPara->para.divideRatio?(FPGA_SYS_HZ/(sysPara->para.divideRatio*2)):0;// 1s时间内墨点数 (即晶振频率 64000)
|
||||
int colNum = sysPara->para.dotNumPerCol?dotNum/sysPara->para.dotNumPerCol:0; // 第列可用墨点数 = 1s时间内墨点数/ 列需要墨点数
|
||||
int colNum = sysPara->para.dotNumPerCol?dotNum/sysPara-> para.dotNumPerCol:0; // 第列可用墨点数 = 1s时间内墨点数/ 列需要墨点数
|
||||
int pulseNum = colNum*sysPara->para.synNumPerCol/(1<<8); //synNumPerCol是被放大后的值
|
||||
|
||||
int maxMM = 0;
|
||||
@@ -2344,8 +2351,8 @@ void MainWidget::updateSysStatusToUI(){ //100ms
|
||||
// ui->pushButton_Reboot->setEnabled(false);
|
||||
}
|
||||
|
||||
if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance)
|
||||
m_RightBtn->setEnabled(false);
|
||||
// if(sysPara->RFIDPara.inkCardTimeOut || sysPara->RFIDPara.solventCardTimeOut || sysPara->RFIDPara.needMaintenance)
|
||||
// m_RightBtn->setEnabled(false); todo
|
||||
// else if(sysPara->status.selfCheckDone == 1)
|
||||
// {
|
||||
// m_RightBtn->setEnabled(true);
|
||||
@@ -3525,27 +3532,102 @@ bool MainWidget::updatePhaseIndicatorLight(){
|
||||
return sysPara->status.lastPhaseFault;
|
||||
}
|
||||
|
||||
bool MainWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
//双击事件,设置总数xxx,打印该数量后停止
|
||||
if (watched == ui.sub3 || watched == ui.labelProductCnt) {
|
||||
if (m_setNumDlg) {
|
||||
m_setNumDlg->show();
|
||||
return true;
|
||||
}
|
||||
|
||||
//void MainWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
//{
|
||||
// if (event->button() != Qt::LeftButton) {
|
||||
// QWidget::mouseDoubleClickEvent(event);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// QPoint globalPos = event->globalPos();
|
||||
// const int expandSize = 50; // 扩大到50像素
|
||||
|
||||
// // 检测函数
|
||||
// auto isInExpandedRect = [&](QWidget* widget) -> bool {
|
||||
// if (!widget) return false;
|
||||
// QRect rect = widget->geometry();
|
||||
// rect.translate(widget->parentWidget()->mapToGlobal(QPoint(0, 0)));
|
||||
// rect.adjust(-expandSize, -expandSize, expandSize, expandSize);
|
||||
// return rect.contains(globalPos);
|
||||
// };
|
||||
|
||||
// if (isInExpandedRect(ui.sub3)) {
|
||||
// if (m_setNumDlg) {
|
||||
// m_setNumDlg->show();
|
||||
// event->accept();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (isInExpandedRect(ui.fra_state)) {
|
||||
// LogInfoCtrl::instance()->emitSigShow();
|
||||
// event->accept();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// QWidget::mouseDoubleClickEvent(event);
|
||||
//}
|
||||
|
||||
void MainWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton) {
|
||||
QWidget::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
QPoint currentPos = event->globalPos();
|
||||
qint64 currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
// 计算时间和距离
|
||||
qint64 timeDiff = currentTime - m_lastClickTime;
|
||||
int distance = QLineF(m_lastClickPos, currentPos).length();
|
||||
|
||||
// 判断是否为双击(使用自定义阈值)
|
||||
if (timeDiff <= m_doubleClickInterval && distance <= m_doubleClickDistance) {
|
||||
// 触发双击逻辑
|
||||
handleDoubleClick(event);
|
||||
m_lastClickTime = 0; // 重置,防止三连击触发多次
|
||||
m_lastClickPos = QPoint();
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新最后一次点击信息
|
||||
m_lastClickPos = currentPos;
|
||||
m_lastClickTime = currentTime;
|
||||
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
if (watched == ui.fra_state || ui.lb_generalState) {
|
||||
LogInfoCtrl::instance()->emitSigShow();
|
||||
return true;
|
||||
void MainWidget::handleDoubleClick(QMouseEvent *event)
|
||||
{
|
||||
QPoint globalPos = event->globalPos();
|
||||
|
||||
// 检查目标区域
|
||||
if (isInExpandedRect(ui.sub3, globalPos, m_doubleClickDistance)) {
|
||||
if (m_setNumDlg) {
|
||||
m_setNumDlg->show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInExpandedRect(ui.fra_state, globalPos, m_doubleClickDistance)) {
|
||||
LogInfoCtrl::instance()->emitSigShow();
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainWidget::isInExpandedRect(QWidget* widget, const QPoint& globalPos, int expandSize)
|
||||
{
|
||||
if (!widget || !widget->isVisible()) return false;
|
||||
QRect rect = widget->geometry();
|
||||
rect.translate(widget->parentWidget()->mapToGlobal(QPoint(0, 0)));
|
||||
rect.adjust(-expandSize, -expandSize, expandSize, expandSize);
|
||||
return rect.contains(globalPos);
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::onLabelFaultRusumePressed(){
|
||||
if(sysPara){
|
||||
sysPara->status.flagOfSpeedAlarm = false;
|
||||
|
||||
Reference in New Issue
Block a user