Fix an off by 1 bug during hexwidget cursor blinking. (#2368)

1 pixel line sometimes remained on during hexwidget cursor blinking.
This commit is contained in:
karliss 2020-08-04 21:19:17 +03:00 committed by GitHub
parent 2d95786f6e
commit dcb9970f91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,7 +415,7 @@ void HexWidget::paintEvent(QPaintEvent *event)
if (xOffset > 0)
painter.translate(QPoint(-xOffset, 0));
if (event->rect() == cursor.screenPos) {
if (event->rect() == cursor.screenPos.toAlignedRect()) {
/* Cursor blink */
drawCursor(painter);
return;
@ -640,7 +640,7 @@ void HexWidget::onCursorBlinked()
if (!cursorEnabled)
return;
cursor.blink();
QRect cursorRect(cursor.screenPos.x(), cursor.screenPos.y(), cursor.screenPos.width(), cursor.screenPos.height());
QRect cursorRect = cursor.screenPos.toAlignedRect();
viewport()->update(cursorRect.translated(-horizontalScrollBar()->value(), 0));
}