Skip to content

Commit

Permalink
Auto emit characterSelected signal
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 2, 2019
1 parent ac6ed1a commit bd13c36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/symbology/characterwidget.cpp
Expand Up @@ -111,6 +111,7 @@ void CharacterWidget::setColumns( int columns )

void CharacterWidget::setCharacter( QChar character )
{
const bool changed = character != mLastKey;
mLastKey = character.unicode();
QWidget *widget = parentWidget();
if ( widget )
Expand All @@ -119,6 +120,9 @@ void CharacterWidget::setCharacter( QChar character )
if ( scrollArea && mLastKey < 65536 )
scrollArea->verticalScrollBar()->setValue( mLastKey / mColumns * mSquareSize );
}
if ( changed )
emit characterSelected( mLastKey );

update();
}

Expand All @@ -141,7 +145,6 @@ void CharacterWidget::keyPressEvent( QKeyEvent *event )
if ( chr.unicode() != mLastKey )
{
setCharacter( chr );
emit characterSelected( chr );
}
}
}
Expand Down

0 comments on commit bd13c36

Please sign in to comment.