Skip to content

Commit 72f0c14

Browse files
committedMay 22, 2015
Correctly restore font and character for font marker widget
1 parent 69abbb2 commit 72f0c14

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
 

‎src/gui/symbology-ng/characterwidget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ void CharacterWidget::updateColumns( int cols )
114114
update();
115115
}
116116

117+
void CharacterWidget::setCharacter( const QChar& character )
118+
{
119+
lastKey = character.unicode();
120+
update();
121+
}
122+
117123
//! [3]
118124
QSize CharacterWidget::sizeHint() const
119125
{

‎src/gui/symbology-ng/characterwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class GUI_EXPORT CharacterWidget : public QWidget
7676
void updateStyle( const QString &fontStyle );
7777
void updateFontMerging( bool enable );
7878
void updateColumns( int cols );
79+
void setCharacter( const QChar& character );
7980

8081
signals:
8182
void characterSelected( const QChar &character );

‎src/gui/symbology-ng/qgssymbollayerv2widget.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,9 +2491,10 @@ void QgsFontMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
24912491
// layer type is correct, we can do the cast
24922492
mLayer = static_cast<QgsFontMarkerSymbolLayerV2*>( layer );
24932493

2494+
QFont layerFont( mLayer->fontFamily() );
24942495
// set values
24952496
cboFont->blockSignals( true );
2496-
cboFont->setCurrentFont( QFont( mLayer->fontFamily() ) );
2497+
cboFont->setCurrentFont( layerFont );
24972498
cboFont->blockSignals( false );
24982499
spinSize->blockSignals( true );
24992500
spinSize->setValue( mLayer->size() );
@@ -2505,6 +2506,11 @@ void QgsFontMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
25052506
spinAngle->setValue( mLayer->angle() );
25062507
spinAngle->blockSignals( false );
25072508

2509+
widgetChar->blockSignals( true );
2510+
widgetChar->updateFont( layerFont );
2511+
widgetChar->setCharacter( mLayer->character() );
2512+
widgetChar->blockSignals( false );
2513+
25082514
//block
25092515
spinOffsetX->blockSignals( true );
25102516
spinOffsetX->setValue( mLayer->offset().x() );

0 commit comments

Comments
 (0)
Please sign in to comment.