diff --git a/src/app/panels/chart/ColorBarWidget.cpp b/src/app/panels/chart/ColorBarWidget.cpp index 61e0306..4e34289 100644 --- a/src/app/panels/chart/ColorBarWidget.cpp +++ b/src/app/panels/chart/ColorBarWidget.cpp @@ -30,9 +30,15 @@ void ColorBarWidget::paintEvent(QPaintEvent* /*event*/) { const int barY = 2; const int barH = kBarHeight; + // 居中约 74% 宽(对齐原版:色阶条不占满,两侧各留 ~13% 边距)。 + const int marginX = static_cast(W * 0.13); + const int barLeft = marginX; + const int barRight = W - marginX; + const int barW = barRight - barLeft; + if (barW < 10) return; // 等宽色带:每相邻断点一格,等宽(对齐原版图例,非按值比例)。 const int nSeg = static_cast(stops.size()) - 1; - auto segX = [&](int i) { return static_cast(static_cast(i) / nSeg * (W - 1)); }; + auto segX = [&](int i) { return barLeft + static_cast(static_cast(i) / nSeg * barW); }; for (int i = 0; i < nSeg; ++i) { int xL = segX(i), xR = segX(i + 1); @@ -42,7 +48,7 @@ void ColorBarWidget::paintEvent(QPaintEvent* /*event*/) { } // 外边框 p.setPen(QPen(QColor(120, 120, 120), 1)); - p.drawRect(0, barY, W - 1, barH - 1); + p.drawRect(barLeft, barY, barW - 1, barH - 1); // 边界值标签(深色文字,白底可见),在各分格边界下方。 QFont font = p.font(); diff --git a/src/app/panels/chart/RawDataChartView.cpp b/src/app/panels/chart/RawDataChartView.cpp index 9ca2b59..901ee92 100644 --- a/src/app/panels/chart/RawDataChartView.cpp +++ b/src/app/panels/chart/RawDataChartView.cpp @@ -87,8 +87,12 @@ RawDataChartView::RawDataChartView(QWidget* parent) : QWidget(parent) { auto* panner = new QwtPlotPanner(plot_->canvas()); panner->setMouseButton(Qt::LeftButton); - new QwtPlotMagnifier(plot_->canvas()); + auto* magnifier = new QwtPlotMagnifier(plot_->canvas()); + // 反转滚轮方向:Qwt 默认 wheelFactor=0.9 → 上滚缩小;取倒数使「上滚=放大」(常规习惯)。 + magnifier->setWheelFactor(1.0 / 0.9); + // 允许随停靠面板自由收缩(不强制最小宽度→不出横向滚动条,对齐原版响应式填充)。 + plot_->setMinimumSize(0, 0); lay->addWidget(plot_, 1); // ---- 独立色阶条(固定高 36px,QwtPlot 的兄弟 widget)----