Skip to content
Permalink
Browse files

Don't draw background outside of character columns

  • Loading branch information
nyalldawson committed May 1, 2019
1 parent 243acb3 commit c534f5f3eef46d0272537dcaabc127d2378ad687
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/gui/symbology/characterwidget.cpp
@@ -216,15 +216,18 @@ void CharacterWidget::mousePressEvent( QMouseEvent *event )
void CharacterWidget::paintEvent( QPaintEvent *event )
{
QPainter painter( this );
QPalette palette = qApp->palette();
painter.fillRect( event->rect(), QBrush( palette.color( QPalette::Base ) ) );
painter.setFont( mDisplayFont );

QRect redrawRect = event->rect();
int beginRow = redrawRect.top() / mSquareSize;
int endRow = redrawRect.bottom() / mSquareSize;
int beginColumn = redrawRect.left() / mSquareSize;
int endColumn = redrawRect.right() / mSquareSize;
int endColumn = std::min( mColumns - 1, redrawRect.right() / mSquareSize );

QPalette palette = qApp->palette();
QRectF backgroundRect = event->rect();
backgroundRect.setWidth( std::min( backgroundRect.width(), ( endColumn + 1 ) * mSquareSize - backgroundRect.left() ) );
painter.fillRect( backgroundRect, QBrush( palette.color( QPalette::Base ) ) );

painter.setPen( QPen( palette.color( QPalette::Mid ) ) );
for ( int row = beginRow; row <= endRow; ++row )

0 comments on commit c534f5f

Please sign in to comment.
You can’t perform that action at this time.