From 5f0a91569e67e66a4f314033e20f0feb49f7ee6a Mon Sep 17 00:00:00 2001 From: lvjunjie Date: Wed, 28 Oct 2026 11:35:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E6=98=BE=E7=A4=BA=E6=9C=AA=E9=9A=8F=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Include/nmNum/nmPlot/nmPlotView.h | 3 +++ Src/nmNum/nmPlot/nmPlotView.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Include/nmNum/nmPlot/nmPlotView.h b/Include/nmNum/nmPlot/nmPlotView.h index 80c4633c..077c22d4 100644 --- a/Include/nmNum/nmPlot/nmPlotView.h +++ b/Include/nmNum/nmPlot/nmPlotView.h @@ -26,6 +26,9 @@ public slots: signals: + // 鼠标在绘图区内的位置,使用模型坐标。 + void sigPointerPos(double x, double y); + protected: // 拖拽支持 diff --git a/Src/nmNum/nmPlot/nmPlotView.cpp b/Src/nmNum/nmPlot/nmPlotView.cpp index 3f10a045..e0f91f55 100644 --- a/Src/nmNum/nmPlot/nmPlotView.cpp +++ b/Src/nmNum/nmPlot/nmPlotView.cpp @@ -15,6 +15,8 @@ ZX_DEFINE_DYNAMIC(mPlotView, nmPlotView) nmPlotView::nmPlotView() { + // 未按下鼠标时也接收视口移动事件,实时更新模型位置。 + viewport()->setMouseTracking(true); } void nmPlotView::onPrepareContextMenu(QMenu* pMenu, @@ -140,6 +142,8 @@ void nmPlotView::mouseMoveEvent(QMouseEvent* e) // 状态栏 if (rt.contains(pos)) { + // 复用坐标轴换算结果,通知模型位置窗口刷新坐标。 + emit sigPointerPos(dX, dY); s = tr(" Current Pos:%1-%2").arg(sValueX).arg(sValueY); if (!sValueY2.isEmpty()) s += QString("-%1").arg(sValueY2);