Skip to content
Permalink
Browse files

Show helpful explanations about the different label placement modes

when they are selected

These aren't immediately obvious, so give users explicit advice
about what they mean
  • Loading branch information
nyalldawson committed Aug 18, 2020
1 parent 095f89f commit d7a1a02e28da59d70d1909e565dc156eec606ebd
Showing with 106 additions and 26 deletions.
  1. +51 −0 src/gui/qgstextformatwidget.cpp
  2. +55 −26 src/ui/qgstextformatwidgetbase.ui
@@ -1358,6 +1358,57 @@ void QgsTextFormatWidget::updatePlacementWidgets()
mPlacementMaxCharAngleFrame->setVisible( showMaxCharAngleFrame );

mMultiLinesFrame->setEnabled( enableMultiLinesFrame );


QString helperText;
switch ( currentPlacement )
{
case QgsPalLayerSettings::AroundPoint:
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
helperText = tr( "Arranges label candidates in a clockwise circle around the feature, preferring placements to the top-right of the feature." );
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges label candidates in a cluster around the feature's centroid, preferring placements directly over the centroid." );
break;
case QgsPalLayerSettings::OverPoint:
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
helperText = tr( "Arranges label candidates directly over the feature or at a preset offset from the feature." );
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges label candidates directly over the feature's centroid, or at a preset offset from the centroid." );
break;
case QgsPalLayerSettings::Line:
if ( currentGeometryType == QgsWkbTypes::LineGeometry )
helperText = tr( "Arranges label candidates parallel to a generalised line representing the feature. Placements which fall over straighter portions of the line are preferred." );
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges label candidates parallel to a generalised line representing the polygon's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
break;
case QgsPalLayerSettings::Curved:
if ( currentGeometryType == QgsWkbTypes::LineGeometry )
helperText = tr( "Arranges candidates following the curvature of a line feature. Placements which fall over straighter portions of the line are preferred." );
break;
case QgsPalLayerSettings::Horizontal:
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges label candidates scattered throughout the polygon. Labels will always be placed horizontally, with placements further from the edges of the polygon preferred." );
else if ( currentGeometryType == QgsWkbTypes::LineGeometry )
helperText = tr( "Label candidates are arranged horizontally along the length of the feature." );
break;
case QgsPalLayerSettings::Free:
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges label candidates scattered throughout the polygon. Labels are rotated to respect the polygon's orientation, with placements further from the edges of the polygon preferred." );
break;
case QgsPalLayerSettings::OrderedPositionsAroundPoint:
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
helperText = tr( "Label candidates are placed in predefined positions around the features. Preference is given to positions with greatest cartographic appeal, e.g., top right and bottom right of the feature." );
break;
case QgsPalLayerSettings::PerimeterCurved:
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Arranges candidates following the curvature of the feature's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
break;
case QgsPalLayerSettings::OutsidePolygons:
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
helperText = tr( "Label candidates are placed outside of the features, preferring placements which give greatest visual association between the label and the feature." );
break;
}
mPlacementModeDescriptionLabel->setText( helperText );
}

void QgsTextFormatWidget::populateFontCapitalsComboBox()
@@ -4145,21 +4145,50 @@ font-style: italic;</string>
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14" stretch="0,1">
<property name="topMargin">
<number>0</number>
<widget class="QgsCollapsibleGroupBox" name="groupBox">
<property name="title">
<string>General Settings</string>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Placement</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mPlacementModeComboBox"/>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout_13">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_14" stretch="0,1">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mPlacementModeComboBox"/>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;The Placement Mode option controls the overall placement of labels relative to their corresponding features.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mPlacementModeDescriptionLabel">
<property name="text">
<string>TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="mPlacementLineFrame">
@@ -4191,16 +4220,10 @@ font-style: italic;</string>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="1" column="1">
<widget class="QCheckBox" name="chkLineOrientationDependent">
<property name="text">
<string>Allowed positions</string>
<string>Line orientation dependent position</string>
</property>
</widget>
</item>
@@ -4251,10 +4274,16 @@ font-style: italic;</string>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="chkLineOrientationDependent">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Line orientation dependent position</string>
<string>Allowed positions</string>
</property>
</widget>
</item>

0 comments on commit d7a1a02

Please sign in to comment.
You can’t perform that action at this time.