Skip to content

Commit bd13c36

Browse files
committedMay 2, 2019
Auto emit characterSelected signal
1 parent ac6ed1a commit bd13c36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/gui/symbology/characterwidget.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void CharacterWidget::setColumns( int columns )
111111

112112
void CharacterWidget::setCharacter( QChar character )
113113
{
114+
const bool changed = character != mLastKey;
114115
mLastKey = character.unicode();
115116
QWidget *widget = parentWidget();
116117
if ( widget )
@@ -119,6 +120,9 @@ void CharacterWidget::setCharacter( QChar character )
119120
if ( scrollArea && mLastKey < 65536 )
120121
scrollArea->verticalScrollBar()->setValue( mLastKey / mColumns * mSquareSize );
121122
}
123+
if ( changed )
124+
emit characterSelected( mLastKey );
125+
122126
update();
123127
}
124128

@@ -141,7 +145,6 @@ void CharacterWidget::keyPressEvent( QKeyEvent *event )
141145
if ( chr.unicode() != mLastKey )
142146
{
143147
setCharacter( chr );
144-
emit characterSelected( chr );
145148
}
146149
}
147150
}

0 commit comments

Comments
 (0)
Please sign in to comment.