From ef3683af4cdc28d3afb1cfa63f524a457f89e981 Mon Sep 17 00:00:00 2001 From: "DESKTOP-450PEFP\\mainc" Date: Tue, 3 Mar 2026 09:52:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A7=A3=E9=87=8A=E7=BB=93=E8=AE=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=90=8D=E7=A7=B0=EF=BC=8C=E5=AD=97=E4=BD=93=EF=BC=8C?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=EF=BC=8C=E7=BB=93=E8=AE=BA=E5=8D=A0=E6=AF=94?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E4=BD=8D=E7=BD=AE=EF=BC=8C=E5=B1=82?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E5=B1=82=E5=8F=B7=E5=AD=97=E4=BD=93=E7=AD=89?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=202.=E4=BF=AE=E6=94=B9=E8=A7=A3=E9=87=8A?= =?UTF-8?q?=E7=BB=93=E8=AE=BA=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=81=93=E5=AE=BD?= =?UTF-8?q?=E5=90=8E=E7=BB=93=E8=AE=BA=E7=9A=84=E7=AC=A6=E5=8F=B7=E5=8F=98?= =?UTF-8?q?=E5=BD=A2=E7=9A=84BUG=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/TransparentDraggableResult.cpp | 18 +++++-- logPlus/TransparentDraggableResult.h | 6 +++ logPlus/TransparentGroupResult.cpp | 49 +++++++++++++++++++ logPlus/TransparentGroupResult.h | 14 +++++- logPlus/formdraw.cpp | 4 ++ logPlus/qmycustomplot.cpp | 68 +++++++++++++++++++++++++- logPlus/qmycustomplot.h | 4 ++ 7 files changed, 157 insertions(+), 6 deletions(-) diff --git a/logPlus/TransparentDraggableResult.cpp b/logPlus/TransparentDraggableResult.cpp index 910acce..ad837d9 100644 --- a/logPlus/TransparentDraggableResult.cpp +++ b/logPlus/TransparentDraggableResult.cpp @@ -163,12 +163,13 @@ void TransparentDraggableResult::drawResult(double left_Low, double right_Hight, } // 设置矩形范围 -void TransparentDraggableResult::setRange(double left_Low, double right_Hight) +void TransparentDraggableResult::setRange(double left_Low, double right_Hight) { if(left_Low >= right_Hight) return; - double lY1 = mPlot->yAxis->range().lower;//+10 - double lY2 = (mPlot->yAxis->range().upper-mPlot->yAxis->range().lower)/2; + double lY1 = m_nShowPos*g_dPixelPerCm+mPlot->yAxis->range().lower;//+10 + double lY2 = m_nShowPos*g_dPixelPerCm+(mPlot->yAxis->range().upper-mPlot->yAxis->range().lower)* (m_nConclusionProportion /100.0f); + mRect->topLeft->setCoords(left_Low, lY1); mRect->bottomRight->setCoords(right_Hight, mPlot->yAxis->range().upper); @@ -204,6 +205,17 @@ void TransparentDraggableResult::setRange(double left_Low, double right_Hight) //mPlot->replot(); } +void TransparentDraggableResult::setShowProperty(int nCopr, int nSPos, bool bupdate) +{ + m_nConclusionProportion = nCopr; + m_nShowPos = nSPos; + + if (bupdate) + { + setRange(mRect->topLeft->key(), mRect->bottomRight->key()); + } +} + void TransparentDraggableResult::setDragRange(double left_Low, double right_Hight) { if (left_Low >= right_Hight) return; diff --git a/logPlus/TransparentDraggableResult.h b/logPlus/TransparentDraggableResult.h index 6ba5d62..a8736da 100644 --- a/logPlus/TransparentDraggableResult.h +++ b/logPlus/TransparentDraggableResult.h @@ -35,6 +35,8 @@ public: void drawResult(double left_Low, double right_Hight, double lY1, double lY2); // 设置矩形范围 void setRange(double left_Low, double right_Hight); + // 设置结论占比% + void setShowProperty(int nCopr, int nSPos, bool bupdate = false); void setDragRange(double left_Low, double right_Hight); // 获取当前范围 QCPRange getRange(); @@ -95,6 +97,10 @@ private: // 添加最小宽度成员变量 double mMinWidth; + // 结论占比% + int m_nConclusionProportion = 50; + // 显示位置cm + int m_nShowPos = 0; }; #endif // TRANSPARENTDRAGGABLERESUL_H diff --git a/logPlus/TransparentGroupResult.cpp b/logPlus/TransparentGroupResult.cpp index 638e54f..7f6411f 100644 --- a/logPlus/TransparentGroupResult.cpp +++ b/logPlus/TransparentGroupResult.cpp @@ -33,6 +33,7 @@ void TransparentGroupResult::addResultToPlot(double left_Low, double right_Hight // 在初始化代码中 TransparentDraggableResult *dragRect = new TransparentDraggableResult(mPlot, upDragRect, strUuid); + dragRect->setShowProperty(m_nConclusionProportion, m_nShowPos); //图片,提前设值,后面setRange改变 dragRect->setResult(myResult); // 设置初始范围 @@ -99,6 +100,54 @@ QCPRange TransparentGroupResult::getRange() return QCPRange(mRect->topLeft->coords().x(), mRect->bottomRight->coords().x()); } +void TransparentGroupResult::setGroupConclusionProportion(int nCopr) +{ + if (nCopr > 0) + { + m_nConclusionProportion = nCopr; + } + + QObjectList objList = m_mapDraggable_Result.values(); + for (int i = 0; i < objList.size(); i++) + { + TransparentDraggableResult* p = qobject_cast(objList.at(i)); + if (p) + { + p->setShowProperty(m_nConclusionProportion, m_nShowPos, true); + } + } +} + +void TransparentGroupResult::setGroupShowPos(int nSPos) +{ + if (nSPos > 0) + { + m_nShowPos = nSPos; + } + + QObjectList objList = m_mapDraggable_Result.values(); + for (int i = 0; i < objList.size(); i++) + { + TransparentDraggableResult* p = qobject_cast(objList.at(i)); + if (p) + { + p->setShowProperty(m_nConclusionProportion, m_nShowPos, true); + } + } +} + +void TransparentGroupResult::setFloorVisible(bool bs) +{ + mItemTitle->setVisible(bs); + mPlot->replot(); +} + +void TransparentGroupResult::setFloorFont(QFont f) +{ + mItemTitle->setFont(f); + mPlot->replot(); +} + // 删除框图 void TransparentGroupResult::deleteRect() { diff --git a/logPlus/TransparentGroupResult.h b/logPlus/TransparentGroupResult.h index af09592..78491e9 100644 --- a/logPlus/TransparentGroupResult.h +++ b/logPlus/TransparentGroupResult.h @@ -35,7 +35,14 @@ public: void setDragRange(double left_Low, double right_Hight); // 获取当前范围 QCPRange getRange(); - + + // 设置结论占比% + void setGroupConclusionProportion(int nCopr); + // 设置显示位置 + void setGroupShowPos(int nSPos); + void setFloorVisible(bool bs); + void setFloorFont(QFont f); + // 删除框图 void deleteRect(); @@ -88,6 +95,11 @@ private: // 添加最小宽度成员变量 double mMinWidth; + // 设置结论占比% + int m_nConclusionProportion = 50; + // 显示位置cm + int m_nShowPos = 0; + QVector m_vecResult; QMap m_mapDraggable_Result; bool m_bArrow = false; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 3eeb0d2..4ca7ee3 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -906,6 +906,10 @@ void FormDraw::setColWidth(int iNewWidth) { int dHight = form->geometry().height(); form->setGeometry(0, 0, iNewWidth, (int)dHight);//7500-3184 + if (form->m_strLineName == "RESULT") + { + form->setConclusionProportion(0); + } form->replot();//屏蔽,缩减时间 } } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index ea67c9d..a796d4d 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -142,7 +142,7 @@ void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW) //curv->setMaximumHeight((int)dHight); //curv->setViewport(QRect(0, 0, g_iOneWidth, (int)dHight));//7500-3184 - this->setGeometry(0, 0, nW-1, (int)dHight);//7500-3184 + this->setGeometry(0, 0, nW, (int)dHight);//7500-3184 } void QMyCustomPlot::changePropertyWaveUpdate() @@ -599,6 +599,58 @@ void QMyCustomPlot::groupEndResult() m_strGroupUid = ""; } +void QMyCustomPlot::setShowProperty(QVariant val, int ntag) +{ + QObjectList objList = m_mapDragGroup.values(); + for (int i = 0; i < objList.size(); i++) + { + TransparentGroupResult *pGroup = qobject_cast(objList.at(i)); + if (pGroup == nullptr) + continue; + if (ntag == 1) + { + pGroup->setGroupConclusionProportion(val.toInt()); + } + else if (ntag == 2) + { + pGroup->setGroupShowPos(val.toInt()); + } + else if (ntag == 3) + { + pGroup->setFloorVisible(val.toBool()); + } + else if (ntag == 4) + { + QFont f = val.value(); + pGroup->setFloorFont(f); + } + } +} + +void QMyCustomPlot::setConclusionProportion(int nCopro) +{ + QObjectList objList = m_mapDragGroup.values(); + for (int i = 0; i < objList.size(); i++) + { + TransparentGroupResult *pGroup = qobject_cast(objList.at(i)); + if (pGroup == nullptr) + continue; + pGroup->setGroupConclusionProportion(nCopro); + } +} + +void QMyCustomPlot::setShowPos(int nSPos) +{ + QObjectList objList = m_mapDragGroup.values(); + for (int i = 0; i < objList.size(); i++) + { + TransparentGroupResult *pGroup = qobject_cast(objList.at(i)); + if (pGroup == nullptr) + continue; + pGroup->setGroupShowPos(nSPos); + } +} + //蝌蚪图,重绘网格线 void QMyCustomPlot::drawCustomElements() { @@ -1999,7 +2051,19 @@ void QMyCustomPlot::s_changeDrawProperty(QVariantList vlist) } else if ("结论占比%" == strProperty) { - + this->setShowProperty(varVal, 1); + } + else if ("显示位置(cm)" == strProperty) + { + this->setShowProperty(varVal, 2); + } + else if ("显示层号" == strProperty) + { + this->setShowProperty(varVal, 3); + } + else if ("层号字体" == strProperty) + { + this->setShowProperty(varVal, 4); } this->replot(); } diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 0f240bd..1391a72 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -41,6 +41,10 @@ public: void groupBeginResult(float fEndDepth, float fStartDepth); void groupEndResult(); + // 设置解释结论属性 + void setShowProperty(QVariant val, int ntag); + void setConclusionProportion(int nCopro); + void setShowPos(int nSPos); protected: //virtual void mouseMoveEvent(QMouseEvent *event);