Skip to content

Commit

Permalink
fix no plotter case
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzawa-san committed Oct 18, 2024
1 parent 22d2adc commit 9ac42c6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,15 +1088,14 @@ void CPlotter::paintEvent(QPaintEvent *)

QPainter painter(this);

int plotWidthT = 0;
int plotHeightT = 0;
if (!m_2DPixmap.isNull())
{
const int plotWidthS = m_2DPixmap.width();
const int plotHeightS = m_2DPixmap.height();
const QRectF plotRectS(0.0, 0.0, plotWidthS, plotHeightS);

plotWidthT = qRound((qreal)plotWidthS / m_DPR);
const int plotWidthT = qRound((qreal)plotWidthS / m_DPR);
plotHeightT = qRound((qreal)plotHeightS / m_DPR);
const QRectF plotRectT(0.0, 0.0, plotWidthT, plotHeightT);

Expand All @@ -1106,16 +1105,17 @@ void CPlotter::paintEvent(QPaintEvent *)
if (!m_WaterfallImage.isNull())
{
const int wfWidth = m_WaterfallImage.width();
const int wfWidthT = qRound((qreal)wfWidth / m_DPR);
const int wfHeight = m_WaterfallImage.height();
const int firstHeightS = wfHeight - m_WaterfallOffset;
const qreal firstHeightT = firstHeightS / m_DPR;
const qreal secondHeightT = m_WaterfallOffset / m_DPR;
// draw the waterfall in two parts based on the location of the offset:
// the first draw is the section below the offset to be drawm at top
painter.drawImage(QRectF(0.0, plotHeightT, plotWidthT, firstHeightT), m_WaterfallImage,
painter.drawImage(QRectF(0.0, plotHeightT, wfWidthT, firstHeightT), m_WaterfallImage,
QRectF(0.0, m_WaterfallOffset, wfWidth, firstHeightS));
// the second draw is the section above the offset to be drawn below
painter.drawImage(QRectF(0.0, plotHeightT + firstHeightT, plotWidthT, secondHeightT), m_WaterfallImage,
painter.drawImage(QRectF(0.0, plotHeightT + firstHeightT, wfWidthT, secondHeightT), m_WaterfallImage,
QRectF(0.0, 0.0, wfWidth, m_WaterfallOffset));
}
}
Expand Down Expand Up @@ -1775,7 +1775,10 @@ void CPlotter::draw(bool newData)
const int half = qRound(radius + m_DPR + shadowOffset);
const int full = half * 2;
m_PeakPixmap = QPixmap(full, full);
m_PeakPixmap.fill(Qt::transparent);
QColor bg = QColor(m_MainLineCol);
bg.setAlpha(128);
m_PeakPixmap.fill(bg);
//m_PeakPixmap.fill(Qt::transparent);
QPainter peakPainter(&m_PeakPixmap);
peakPainter.translate(half, half);
QPen peakPen(m_MainLineCol, m_DPR);
Expand Down

0 comments on commit 9ac42c6

Please sign in to comment.