Skip to content

Commit

Permalink
Correctly restore font and character for font marker widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 22, 2015
1 parent 69abbb2 commit 72f0c14
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/gui/symbology-ng/characterwidget.cpp
Expand Up @@ -114,6 +114,12 @@ void CharacterWidget::updateColumns( int cols )
update();
}

void CharacterWidget::setCharacter( const QChar& character )
{
lastKey = character.unicode();
update();
}

//! [3]
QSize CharacterWidget::sizeHint() const
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/symbology-ng/characterwidget.h
Expand Up @@ -76,6 +76,7 @@ class GUI_EXPORT CharacterWidget : public QWidget
void updateStyle( const QString &fontStyle );
void updateFontMerging( bool enable );
void updateColumns( int cols );
void setCharacter( const QChar& character );

signals:
void characterSelected( const QChar &character );
Expand Down
8 changes: 7 additions & 1 deletion src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Expand Up @@ -2491,9 +2491,10 @@ void QgsFontMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
// layer type is correct, we can do the cast
mLayer = static_cast<QgsFontMarkerSymbolLayerV2*>( layer );

QFont layerFont( mLayer->fontFamily() );
// set values
cboFont->blockSignals( true );
cboFont->setCurrentFont( QFont( mLayer->fontFamily() ) );
cboFont->setCurrentFont( layerFont );
cboFont->blockSignals( false );
spinSize->blockSignals( true );
spinSize->setValue( mLayer->size() );
Expand All @@ -2505,6 +2506,11 @@ void QgsFontMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
spinAngle->setValue( mLayer->angle() );
spinAngle->blockSignals( false );

widgetChar->blockSignals( true );
widgetChar->updateFont( layerFont );
widgetChar->setCharacter( mLayer->character() );
widgetChar->blockSignals( false );

//block
spinOffsetX->blockSignals( true );
spinOffsetX->setValue( mLayer->offset().x() );
Expand Down

0 comments on commit 72f0c14

Please sign in to comment.