Skip to content

Commit

Permalink
Fix missing initial line label placement hint text
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 2, 2020
1 parent f5ce577 commit 682740f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/gui/labeling/qgslabellineanchorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,11 @@ QgsLabelLineAnchorWidget::QgsLabelLineAnchorWidget( QWidget *parent, QgsVectorLa
if ( !mBlockSignals )
emit changed();

QString hint;
switch ( static_cast< QgsLabelLineSettings::AnchorType >( mAnchorTypeComboBox->currentData().toInt() ) )
{
case QgsLabelLineSettings::AnchorType::Strict:
hint = tr( "Labels are placed exactly on the label anchor only, and no other fallback placements are permitted." );
break;

case QgsLabelLineSettings::AnchorType::HintOnly:
hint = tr( "The label anchor is treated as a hint for the preferred label placement, but other placements close to the anchor point are permitted." );
break;
}
mAnchorTypeHintLabel->setText( hint );
updateAnchorTypeHint();
} );

registerDataDefinedButton( mLinePlacementDDBtn, QgsPalLayerSettings::LineAnchorPercent );
updateAnchorTypeHint();
}

void QgsLabelLineAnchorWidget::setSettings( const QgsLabelLineSettings &settings )
Expand Down Expand Up @@ -117,3 +107,19 @@ void QgsLabelLineAnchorWidget::updateDataDefinedProperties( QgsPropertyCollectio
{
properties.setProperty( QgsPalLayerSettings::LineAnchorPercent, mDataDefinedProperties.property( QgsPalLayerSettings::LineAnchorPercent ) );
}

void QgsLabelLineAnchorWidget::updateAnchorTypeHint()
{
QString hint;
switch ( static_cast< QgsLabelLineSettings::AnchorType >( mAnchorTypeComboBox->currentData().toInt() ) )
{
case QgsLabelLineSettings::AnchorType::Strict:
hint = tr( "Labels are placed exactly on the label anchor only, and no other fallback placements are permitted." );
break;

case QgsLabelLineSettings::AnchorType::HintOnly:
hint = tr( "The label anchor is treated as a hint for the preferred label placement, but other placements close to the anchor point are permitted." );
break;
}
mAnchorTypeHintLabel->setText( hint );
}
1 change: 1 addition & 0 deletions src/gui/labeling/qgslabellineanchorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class GUI_EXPORT QgsLabelLineAnchorWidget : public QgsLabelSettingsWidgetBase, p

bool mBlockSignals = false;

void updateAnchorTypeHint();
};

#endif // QGSLABELLINEANCHORWIDGET_H

0 comments on commit 682740f

Please sign in to comment.