From 944a16725d9d8ad0fef86fa33951317c2fcb072e Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Tue, 28 Apr 2026 17:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B2=A9=E5=BF=83=E5=9B=BE=E7=89=87=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/qmycustomplot.cpp | 74 ++++++++++++++++----------- logPlus/transparentdraggableimage.cpp | 14 ++--- 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 2d2799b..38943bc 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -889,7 +889,7 @@ void QMyCustomPlot::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { - if (m_strLineName == "RESULT") + if (m_strLineName == "RESULT" || m_strLineName == "IMAGE_DATA") { if (m_bEditor) { @@ -985,7 +985,7 @@ void QMyCustomPlot::mousePressEvent(QMouseEvent *event) void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) { - if (m_strLineName == "RESULT") + if (m_strLineName == "RESULT" || m_strLineName == "IMAGE_DATA") { if (mMousePress) { @@ -1138,7 +1138,14 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) } else { - this->setCursor(Qt::ArrowCursor); + QCursor currentCursor = this->cursor(); + if(currentCursor == Qt::CrossCursor) + { + } + else + { + this->setCursor(Qt::ArrowCursor); + } } // if (mMousePress) { // auto items = selectedItems(); @@ -1180,7 +1187,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) void QMyCustomPlot::mouseReleaseEvent(QMouseEvent *event) { - if (m_strLineName == "RESULT") + if (m_strLineName == "RESULT" || m_strLineName == "IMAGE_DATA") { if (mMousePress) { @@ -1955,9 +1962,17 @@ void QMyCustomPlot::onEditImage() if (dlg.exec() == QDialog::Accepted) // 点击“确定”按钮 { imagePath = dlg.getImagePath(); + m_pAddLine1->setVisible(false); + m_pAddLine2->setVisible(false); + mMousePress = false; + replot(); } else { + m_pAddLine1->setVisible(false); + m_pAddLine2->setVisible(false); + mMousePress = false; + replot(); return; } @@ -3210,11 +3225,12 @@ bool QMyCustomPlot::SaveToSLFImage() isrun=false; return false; } - iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4, - "NO,SDEP,EDEP,RESULT", - "4,4,4,4",//字段长度 - "1,4,4,1",//字段类型 - "0,0,0,2");//字段备注 + + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),0,6, + "NO,SDEP,EDEP,LEFT,WIDTH,IMAGE", + "4,4,4,4,4,100",//字段长度 + "1,4,4,4,4,6",//字段类型 + "0,0,0,0,0,0");//字段备注 isfirst=true; } logio->SetTableRecordCount(iIndex,m_mapDraggable_Image.size()); @@ -3251,18 +3267,22 @@ bool QMyCustomPlot::SaveToSLFImage() float fSDepth = -tmpRange.upper; if(fSDepth == listSDepth[i])//按顺序写入 { - memset(&m_Result,0,sizeof(GUJING_DATA)); + memset(&m_Result,0,sizeof(IMAGE_DATA)); m_Result.StartDepth = -tmpRange.upper; m_Result.EndDepth = -tmpRange.lower; - m_Result.Order=i+1; - // 拷贝字符串到数组,长度为数组长度-1(留1位存'\0'结束符) - strncpy(m_Result.Image, pDraggableRect->getMResult().toLocal8Bit().constData(), sizeof(m_Result.Image) - 1); - // 手动添加结束符(确保字符串合法) - m_Result.Image[sizeof(m_Result.Image) - 1] = '\0'; m_Result.Left = static_cast(pDraggableRect->getLeft()); + m_Result.Order=i+1; m_Result.Width = static_cast(pDraggableRect->getWidth()); - //写入 + QString result = pDraggableRect->getMResult(); + strcpy(m_Result.Image, result.toStdString().c_str()); logio->WriteTable(iIndex,i+1,&m_Result); + + qDebug() << "===---======" << result; + qDebug() << "===---====-----------==" << m_Result.Image; + //写入 + qDebug() << "Save: sizeof IMAGE_DATA=" << sizeof(IMAGE_DATA); + qDebug() << "Save: Image size=" << sizeof(m_Result.Image); + break; } } @@ -3304,7 +3324,7 @@ bool QMyCustomPlot::saveToSLFCorePhysics() isrun=false; return false; } - iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4, + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),CORE_PHYSICS_OBJECT,4, "NO,SDEP,EDEP,RESULT", "4,4,4,4",//字段长度 "1,4,4,1",//字段类型 @@ -3341,7 +3361,7 @@ bool QMyCustomPlot::saveToSLFCorePhysics() float fSDepth = -pDraggableRect->m_right_Hight; if(fSDepth == listSDepth[i])//按顺序写入 { - memset(&m_Result,0,sizeof(GUJING_DATA)); + memset(&m_Result,0,sizeof(Slf_CORE_PHYSICS)); m_Result.Order = i + 1; m_Result.CoreValue = -pDraggableRect->getCpCoreValue(); m_Result.Depth = -pDraggableRect->m_right_Hight; @@ -4029,21 +4049,10 @@ bool QMyCustomPlot::LoadFromIMAGE_SLF(QString strSlfName, QString strLineName) for(int i=0;iReadTable(iIndex,i+1,m_Result); - // WelllogItem* item=AddItem(m_Result->StartDepth,m_Result->EndDepth); - // if(!item) continue; - // OGWordsResultItem* pResult = dynamic_cast(item); - //logio->GetTableFieldData(iIndex,(char*)FieldName.toStdString().c_str(),m_Result->Image,i+1); - - - // SetCharacters(m_Result->Words); - - // fontColor=QColor(0,0,0,255); - // backgroundColor=QColor(255,255,255,255); - // wordfont.setFamily("黑体"); - // wordfont.setPointSize(10); //显示图片Image QString filename=QString::fromLocal8Bit(m_Result->Image); + qDebug() << "=--==-=-------------------------" << filename; int pos=filename.lastIndexOf("\\"); int pos1=filename.lastIndexOf("/"); if(pos1>pos) pos=pos1; @@ -4053,6 +4062,10 @@ bool QMyCustomPlot::LoadFromIMAGE_SLF(QString strSlfName, QString strLineName) filename=""; } } + + qDebug() << "Load: sizeof IMAGE_DATA=" << sizeof(IMAGE_DATA); + qDebug() << "Load: Image size=" << sizeof(m_Result->Image); + this->addImageToPlot(-m_Result->EndDepth, -m_Result->StartDepth, filename, static_cast(m_Result->Left), static_cast(m_Result->Width)); } logio->CloseTable(iIndex); @@ -8577,6 +8590,7 @@ void QMyCustomPlot::onCloseEditResult() //取消框选 this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables); this->setSelectionRectMode(QCP::srmNone); + this->setCursor(Qt::ArrowCursor); } void QMyCustomPlot::DeleteItemGroup() diff --git a/logPlus/transparentdraggableimage.cpp b/logPlus/transparentdraggableimage.cpp index f7b30e7..769e515 100644 --- a/logPlus/transparentdraggableimage.cpp +++ b/logPlus/transparentdraggableimage.cpp @@ -448,13 +448,13 @@ void TransparentDraggableImage::onMouseMove(QMouseEvent *event) // 无论哪种模式(只要不是 DragNone),都显示参考线 if(mDragMode == DragReferenceOnly) { - mDragLine->point1->setCoords(mDragStartY, 0); - mDragLine->point2->setCoords(mDragStartY, 1); - mDragLine->setVisible(true); - mDragLine2->point1->setCoords(currentY, 0); - mDragLine2->point2->setCoords(currentY, 1); - mDragLine2->setVisible(true); - mPlot->replot(); +// mDragLine->point1->setCoords(mDragStartY, 0); +// mDragLine->point2->setCoords(mDragStartY, 1); +// mDragLine->setVisible(true); +// mDragLine2->point1->setCoords(currentY, 0); +// mDragLine2->point2->setCoords(currentY, 1); +// mDragLine2->setVisible(true); +// mPlot->replot(); return; }