From cd8a7273f1278b3da783248b5c040f91959abcdb Mon Sep 17 00:00:00 2001 From: iorebuild Date: Thu, 30 Apr 2026 13:35:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=9A=E9=81=93=E5=9B=BE=E4=BE=8B?= =?UTF-8?q?=E4=B8=8D=E5=8B=BE=E9=80=89=E6=97=B6=E6=98=BE=E7=A4=BA=E7=81=B0?= =?UTF-8?q?=E8=89=B2=E6=96=B9=E5=9D=97+=E8=BE=B9=E6=A1=86=EF=BC=8C?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E7=AB=8B=E5=8D=B3=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 图例方块:勾选=彩色,不勾选=深灰+白边框,一目了然 - setChannelVisible 立即 update() 不再等定时器,消除点击延迟 --- plotwidget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plotwidget.cpp b/plotwidget.cpp index af3adaa..b6178c1 100644 --- a/plotwidget.cpp +++ b/plotwidget.cpp @@ -101,6 +101,7 @@ void PlotWidget::setChannelVisible(int channel, bool visible) if (channel >= 0 && channel < 16) { m_channelVisible[channel] = visible; m_dirty = true; + update(); // 立即刷新,不等定时器 } } @@ -381,13 +382,17 @@ void PlotWidget::drawLegend(QPainter &painter) for (int ch = 0; ch < 16; ++ch) { int y = legendY + ch * itemHeight; - // 颜色方块 - QColor color = m_channelVisible[ch] ? m_colors[ch] : QColor("#444444"); + // 颜色方块:勾选=彩色,不勾选=灰白 + QColor color = m_channelVisible[ch] ? m_colors[ch] : QColor("#555555"); painter.fillRect(QRect(legendX, y + 2, 12, 12), color); + if (!m_channelVisible[ch]) { + painter.setPen(QPen(QColor("#888888"), 1)); + painter.drawRect(QRect(legendX, y + 2, 12, 12)); + } // 通道名 QString label = QString("ch%1").arg(ch); - painter.setPen(m_channelVisible[ch] ? m_textColor : QColor("#666666")); + painter.setPen(m_channelVisible[ch] ? m_textColor : QColor("#555555")); painter.drawText(QRect(legendX + 16, y, 50, itemHeight), Qt::AlignLeft | Qt::AlignVCenter, label); }