Jelajahi Sumber

修复越界问题和十字线双边

yun 1 hari lalu
induk
melakukan
a8074bee65

+ 39 - 39
View/die-bonder-ui/ImageView.cpp

@@ -31,7 +31,7 @@ ImageView::ImageView(QWidget* parent) :
     setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
     this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    //������ͼ����
+    //设置视图属性
     //setRenderHint(QPainter::SmoothPixmapTransform);
     setRenderHint(QPainter::Antialiasing);
     setMouseTracking(true);
@@ -53,9 +53,9 @@ void ImageView::setPixmap(const QPixmap& newPixmap) {
     scene()->setSceneRect(sceneRect);
     setSceneRect(scene()->itemsBoundingRect());
     this->resize(m_pixmap.width(), m_pixmap.height());
-    m_imageOffset = QPoint(0, 0); // ����ͼƬƫ����Ϊ(0, 0)
+    m_imageOffset = QPoint(0, 0); 
     setCursor(Qt::ArrowCursor);
-    update(); // �����ػ�
+    update(); 
 }
 
 void ImageView::setCurPixmap(const QPixmap& newPixmap) {
@@ -70,9 +70,9 @@ void ImageView::setCurPixmap(const QPixmap& newPixmap) {
         scene()->setSceneRect(sceneRect);
         setSceneRect(scene()->itemsBoundingRect());
         //this->resize(m_pixmap.width(), m_pixmap.height());
-        m_imageOffset = QPoint(0, 0); // ����ͼƬƫ����Ϊ(0, 0)
+        m_imageOffset = QPoint(0, 0); 
         setCursor(Qt::ArrowCursor);
-        update(); // �����ػ�
+        update();
     }
     else {
         this->m_pixmap = newPixmap;
@@ -100,7 +100,7 @@ void ImageView::paintEvent(QPaintEvent* event) {
 
 void ImageView::mousePressEvent(QMouseEvent* event) {
     if (event->button() == Qt::LeftButton) {
-        // ��������û�� item ʱ�������ƶ�
+        
         QPointF point = mapToScene(event->pos());
         if (scene()->itemAt(point, transform()) != nullptr
             && scene()->itemAt(point, transform())->type() == QGraphicsPixmapItem::Type) {
@@ -115,7 +115,7 @@ void ImageView::mousePressEvent(QMouseEvent* event) {
 
         if (m_bRulerState) {
             if (!m_isCreating) {
-                // ��һ�ε������ʼ����
+                
                 m_isCreating = true;
                 m_startPos = mapToScene(event->pos());
                 m_pTempLine = scene()->addLine(QLineF(m_startPos, m_startPos),
@@ -123,7 +123,7 @@ void ImageView::mousePressEvent(QMouseEvent* event) {
                 m_pTempLine->setZValue(2);
             }
             else {
-                // �ڶ��ε������ɴ���
+                
                 m_isCreating = false;
                 QPointF endPos = mapToScene(event->pos());
                 scene()->removeItem(m_pTempLine);
@@ -147,17 +147,17 @@ void ImageView::mouseMoveEvent(QMouseEvent* event) {
     }
 
     if (m_bMouseTranslate) {
-        // ������굱ǰλ�����ϴ�λ�õIJ�ֵ
+        
         QPointF delta = event->pos() - m_lastMousePos;
-        // ƽ����ͼ
+        
         horizontalScrollBar()->setValue(horizontalScrollBar()->value() - delta.x());
         verticalScrollBar()->setValue(verticalScrollBar()->value() - delta.y());
-        m_lastMousePos = event->pos();  // ��������
+        m_lastMousePos = event->pos();  
     }
     else if ((event->buttons() & Qt::RightButton) && m_isDrawing && m_rightButtonPressed) {
         if (!m_curDrawing && (event->pos() - m_rightClickPressPos).manhattanLength() > 5) {
             m_curDrawing = true;
-            // ���ݳ�ʼλ�ÿ�ʼ����·��
+            
             QPointF scenePos = mapToScene(m_rightClickPressPos);
             m_currentPath = QPainterPath(scenePos);
             m_currentPathItem = new QGraphicsPathItem();
@@ -214,7 +214,7 @@ void ImageView::mouseReleaseEvent(QMouseEvent* event) {
 void ImageView::wheelEvent(QWheelEvent* event)
 {
     if (event->orientation() == Qt::Vertical) {
-        event->ignore(); // ������ֱ�����¼��������ù�����������
+        event->ignore(); 
         return;
     }
     event->accept();
@@ -223,13 +223,13 @@ void ImageView::wheelEvent(QWheelEvent* event)
 void ImageView::resizeEvent(QResizeEvent* event)
 {
     QGraphicsView::resizeEvent(event);
-    viewport()->update();  // ���ڴ�С�ı�ʱ�ػ�ʮ����
+    viewport()->update(); 
 }
 
 void ImageView::scrollContentsBy(int dx, int dy)
 {
     QGraphicsView::scrollContentsBy(dx, dy);
-    viewport()->update();  // ����ʱ����ʮ����
+    viewport()->update();  
 }
 
 void ImageView::drawCrosshair(QPainter& painter)
@@ -238,67 +238,67 @@ void ImageView::drawCrosshair(QPainter& painter)
     int resolutionWidth = viewRect.width();
     int resolutionHeight = viewRect.height();
     painter.setPen(QPen(QColor(139, 105, 20, 255), 1));
-    // ���ƴ�ֱ��
+    
     painter.drawLine(resolutionWidth / 2, 0, resolutionWidth / 2, resolutionHeight);
-    // ����ˮƽ��
+   
     painter.drawLine(0, resolutionHeight / 2, resolutionWidth, resolutionHeight / 2);
 
     int centerX = resolutionWidth / 2;
     int centerY = resolutionHeight / 2;
 
-    int rulerLength = viewRect.width(); // ���߳���
-    int tickSpacing = 5; // �̶ȼ��
+    int rulerLength = viewRect.width(); 
+    int tickSpacing = 5;
 
-    // ����ˮƽ�������ϵ�����
+    
     int rulerStartXHorizontal = centerX;
     int rulerStartYHorizontal = centerY;
 
     for (int i = 0; i <= rulerLength / 2; i += tickSpacing) {
         int tickHeight = 0;
-        if (i % (tickSpacing * 10) == 0) { // ���̶�
-            tickHeight = 15;
+        if (i % (tickSpacing * 10) == 0) {
+            tickHeight = 30;
         }
-        else if (i % (tickSpacing * 5) == 0) { // �еȿ̶�
-            tickHeight = 10;
+        else if (i % (tickSpacing * 5) == 0) { 
+            tickHeight = 15;
         }
-        else { // �̶̿�
+        else {
             tickHeight = 5;
         }
 
-        painter.drawLine(rulerStartXHorizontal + i, rulerStartYHorizontal, rulerStartXHorizontal + i, rulerStartYHorizontal - tickHeight); // ���ƿ̶���
-        painter.drawLine(rulerStartXHorizontal - i, rulerStartYHorizontal, rulerStartXHorizontal - i, rulerStartYHorizontal - tickHeight); // ���ƿ̶���
+        painter.drawLine(rulerStartXHorizontal + i, rulerStartYHorizontal + tickHeight, rulerStartXHorizontal + i, rulerStartYHorizontal - tickHeight);
+        painter.drawLine(rulerStartXHorizontal - i, rulerStartYHorizontal + tickHeight, rulerStartXHorizontal - i, rulerStartYHorizontal - tickHeight);
     }
 
-    // ���ƴ�ֱ�������ϵ�����
+    
     int rulerStartXVertical = centerX; 
     int rulerStartYVertical = centerY;
 
     for (int i = 0; i <= rulerLength / 2; i += tickSpacing) {
         int tickWidth = 0;
-        if (i % (tickSpacing * 10) == 0) { // ���̶�
+        if (i % (tickSpacing * 10) == 0) {
             tickWidth = 15;
         }
-        else if (i % (tickSpacing * 5) == 0) { // �еȿ̶�
+        else if (i % (tickSpacing * 5) == 0) { 
             tickWidth = 10;
         }
-        else { // �̶̿�
+        else { 
             tickWidth = 5;
         }
-        painter.drawLine(rulerStartXVertical, rulerStartYVertical - i, rulerStartXVertical - tickWidth, rulerStartYVertical - i);
-        painter.drawLine(rulerStartXVertical, rulerStartYVertical + i, rulerStartXVertical - tickWidth, rulerStartYVertical + i); 
+        painter.drawLine(rulerStartXVertical+ tickWidth, rulerStartYVertical - i, rulerStartXVertical - tickWidth, rulerStartYVertical - i);
+        painter.drawLine(rulerStartXVertical + tickWidth, rulerStartYVertical + i, rulerStartXVertical - tickWidth, rulerStartYVertical + i);
     }
 }
 
 void ImageView::saveImage()
 {
-    // ʹ�õ�ǰʱ������Ĭ���ļ���
+    
     QString defaultFileName = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss") + ".png";
 
     QString fileName = QFileDialog::getSaveFileName(
         this,
-        tr("����ͼƬ"),
-        QDir::homePath() + "/" + defaultFileName, // Ĭ��·��Ϊ�û�Ŀ¼���ļ���Ϊ��ǰʱ��
-        tr("PNG �ļ� (*.png);;JPEG �ļ� (*.jpg);;�����ļ� (*)")
+        tr("save picture"),
+        QDir::homePath() + "/" + defaultFileName,
+        tr("PNG  (*.png);;JPEG  (*.jpg);; (*)")
     );
     if (!fileName.isEmpty()) {
         QImage image(viewport()->size(), QImage::Format_ARGB32);
@@ -306,10 +306,10 @@ void ImageView::saveImage()
         QPainter painter(&image);
         this->render(&painter);
         if (!image.save(fileName)) {
-            QMessageBox::warning(this, tr("����ʧ��"), tr("�޷�����ͼƬ��ָ��·����"));
+            QMessageBox::warning(this,tr("save failed"),tr("The picture cannot be saved to the specified path"));
         }
         else {
-            QMessageBox::information(this, tr("����ɹ�"), tr("ͼƬ�ѳɹ����浽��") + fileName);
+            QMessageBox::information(this, tr("save sucessful"),tr("The picture has been successfully saved to:") + fileName);
         }
         painter.end();
     }

+ 6 - 6
View/die-bonder-ui/MainWnd.cpp

@@ -888,14 +888,14 @@ void MainWnd::on_pushButton_clicked()
     //加确认关闭提示确认窗口
     // 创建一个消息框
     QMessageBox msgBox;
-    if (gen_if.getLanguageValue() == 0) {
+    //if (gen_if.getLanguageValue() == 0) {
         msgBox.setWindowTitle(tr("Confirm Close"));
         msgBox.setText(tr("Are you sure you want to close the application?"));
-    }
-    else {
-        msgBox.setWindowTitle(tr("确认关闭"));
-        msgBox.setText(tr("你确定要关闭程序吗"));
-    }
+    //}
+    //else {
+    //    msgBox.setWindowTitle(tr("确认关闭"));
+    //    msgBox.setText(tr("你确定要关闭程序吗"));
+    //}
 
     msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
     msgBox.setDefaultButton(QMessageBox::No);

+ 1 - 1
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -230,7 +230,7 @@ void MainAndSecondaryCamerasWnd::initLeftAndRightWidget() {
     {
         return;
     }
-    if (m_allGroup.size() < lastGroupId) {
+    if (m_allGroup.size() < lastGroupId || m_allGroup.size() < lastLastGroupId) {
         //重置记录
         lastGroupId = 1;
         lastIndex = 1;

TEMPAT SAMPAH
View/die-bonder-ui/SBT_zh_CN.qm


+ 15 - 27
View/die-bonder-ui/SBT_zh_CN.ts

@@ -364,40 +364,36 @@
 <context>
     <name>ImageView</name>
     <message>
-        <source>����ͼƬ</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>PNG �ļ� (*.png);;JPEG �ļ� (*.jpg);;�����ļ� (*)</source>
-        <translation type="unfinished"></translation>
+        <source>test ruler</source>
+        <translation></translation>
     </message>
     <message>
-        <source>����ʧ��</source>
-        <translation type="unfinished"></translation>
+        <source>save picture</source>
+        <translation></translation>
     </message>
     <message>
-        <source>�޷�����ͼƬ��ָ��·����</source>
-        <translation type="unfinished"></translation>
+        <source>clear</source>
+        <translation>清除</translation>
     </message>
     <message>
-        <source>�����ɹ�</source>
+        <source>PNG  (*.png);;JPEG  (*.jpg);; (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>ͼƬ�ѳɹ����浽��</source>
-        <translation type="unfinished"></translation>
+        <source>save failed</source>
+        <translation>保存失败</translation>
     </message>
     <message>
-        <source>test ruler</source>
-        <translation type="unfinished"></translation>
+        <source>The picture cannot be saved to the specified path</source>
+        <translation>图片不能保存到该路径下</translation>
     </message>
     <message>
-        <source>save picture</source>
-        <translation type="unfinished"></translation>
+        <source>save sucessful</source>
+        <translation>保存成功</translation>
     </message>
     <message>
-        <source>clear</source>
-        <translation type="unfinished"></translation>
+        <source>The picture has been successfully saved to:</source>
+        <translation>图片已经成功保存到:</translation>
     </message>
 </context>
 <context>
@@ -686,14 +682,6 @@
         <source>Are you sure you want to close the application?</source>
         <translation>你确定要关闭程序吗</translation>
     </message>
-    <message>
-        <source>确认关闭</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>你确定要关闭程序吗</source>
-        <translation type="unfinished"></translation>
-    </message>
     <message>
         <source>Settings</source>
         <comment>设置</comment>

+ 1 - 1
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.cpp

@@ -10,7 +10,7 @@ ControlOperationPage::ControlOperationPage(QWidget* parent)
     m_isEnable = false;
     m_bRuler = false;
 
-
+    updateOperateWidget(QPixmap());
     InitWnd();
     initForm();
 }

+ 1 - 1
View/die-bonder-ui/res.qrc

@@ -101,7 +101,7 @@
         <file>images/LightGroup/red.png</file>
         <file>images/LightGroup/yellow.png</file>
         <file>images/deep/logo1.png</file>
-        <file>SBT_zh_CN.qm</file>
         <file>SBT_en.qm</file>
+        <file>SBT_zh_CN.qm</file>
     </qresource>
 </RCC>