fix: Line numbers for problem case input/output/expected texteditors are not vertically centered.

This commit is contained in:
Roy Qu 2024-01-19 16:23:41 +08:00
parent 2b581531db
commit 26b57f04b7
1 changed files with 2 additions and 2 deletions

View File

@ -198,13 +198,13 @@ void LineNumberTextEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
else else
painter.setPen(mLineNumberAreaForeground); painter.setPen(mLineNumberAreaForeground);
int y=top+std::max(0,bottom-top-fontMetrics().lineSpacing()); int y=top+std::max(0,bottom-top-fontMetrics().lineSpacing());
painter.drawText(5, y, lineNumberArea->width()-10, fontMetrics().height(), painter.drawText(5, top, lineNumberArea->width()-10, fontMetrics().height(),
Qt::AlignRight, number); Qt::AlignRight, number);
} }
block = block.next(); block = block.next();
top = bottom; top = bottom;
bottom = top + qRound(blockBoundingRect(block).height()); bottom = top + qRound(blockBoundingRect(block).height());
++blockNumber; ++blockNumber;
qDebug()<<blockNumber<<qRound(blockBoundingRect(block).height());
} }
} }