Skip to content

Commit 53a8f3a

Browse files
committed
Minor fixes to waveform cursor drawing
1 parent c207a13 commit 53a8f3a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/WidgetWaveform.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,39 +190,39 @@ void WidgetWaveform::drawCursors(QPainter &painter, const QRect &r, uint hstart)
190190
{
191191
QPen pen(Qt::yellow);
192192
painter.setPen(pen);
193+
uint bottom = r.bottom() - 2; // Lift up the cursors a little bit
193194

194195
// If the cursors are linked together, draw the link line
195196
if (m_linked && (m_cursors2x.count() >= 2))
196197
{
197198
uint x1 = m_cursors2x.at(0) * m_hscale / 2.0;
198199
uint x2 = m_cursors2x.at(1) * m_hscale / 2.0;
199-
uint y = r.bottom() - 1 * m_fontheight;
200+
uint y = bottom - 1 * m_fontheight + 1;
200201
painter.drawLine(x1, y, x2, y);
201202
}
202203

203204
for (int i=0; i<m_cursors2x.count(); i++)
204205
{
205206
uint cursorX = m_cursors2x.at(i);
206207
uint x = cursorX * m_hscale / 2.0;
207-
uint y = r.bottom() - i * m_fontheight;
208-
painter.drawLine(x, r.top(), x, y);
208+
uint y = bottom - i * m_fontheight;
209+
painter.drawLine(x, r.top(), x, y + 1);
209210

210211
QString text = QString::number(cursorX / 2 + hstart);
211212
QRect bb = painter.fontMetrics().boundingRect(text);
212213
bb.adjust(x, y, x, y);
213214

214-
painter.drawText(x + 2, r.bottom() - i * m_fontheight, text);
215-
painter.drawRect(bb.adjusted(0, 0, 4, 0));
215+
painter.drawText(x + 2, bottom - i * m_fontheight, text);
216+
painter.drawRect(bb.adjusted(0, 2, 4, -2));
216217
}
217218

218219
// Draw the selected cursor on top
219220
if (m_cursor < uint(m_cursors2x.count()))
220221
{
221222
pen.setWidth(3);
222223
painter.setPen(pen);
223-
uint i = m_cursor;
224-
uint x = m_cursors2x[i] * m_hscale / 2.0;
225-
painter.drawLine(x, r.top(), x, r.bottom() - i * m_fontheight + 1);
224+
uint x = m_cursors2x[m_cursor] * m_hscale / 2.0;
225+
painter.drawLine(x, r.top(), x, bottom - m_cursor * m_fontheight + 1);
226226

227227
emit cursorChanged(m_cursors2x[m_cursor] / 2 + hstart);
228228
}

0 commit comments

Comments
 (0)