Use QRectF for cursor drawing, fix artifacts in hidpi

This commit is contained in:
BlahGeek
2019-07-14 13:03:29 +08:00
committed by Alf Gaida
parent 64fef7ab3c
commit 88e57a57fc
+4 -4
View File
@@ -754,7 +754,7 @@ void TerminalDisplay::drawCursor(QPainter& painter,
const QColor& /*backgroundColor*/,
bool& invertCharacterColor)
{
QRect cursorRect = rect;
QRectF cursorRect = rect;
cursorRect.setHeight(_fontHeight - _lineSpacing - 1);
if (!_cursorBlinking)
@@ -768,12 +768,12 @@ void TerminalDisplay::drawCursor(QPainter& painter,
{
// draw the cursor outline, adjusting the area so that
// it is draw entirely inside 'rect'
int penWidth = qMax(1,painter.pen().width());
float penWidth = qMax(1,painter.pen().width());
painter.drawRect(cursorRect.adjusted(penWidth/2,
penWidth/2,
- penWidth/2 - penWidth%2,
- penWidth/2 - penWidth%2));
- penWidth/2,
- penWidth/2));
if ( hasFocus() )
{
painter.fillRect(cursorRect, _cursorColor.isValid() ? _cursorColor : foregroundColor);