Skip to content

Commit

Permalink
Move numeric format button for scalebars to Units group
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 9, 2020
1 parent 1cd2e16 commit 4391fe7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 41 deletions.
15 changes: 12 additions & 3 deletions src/app/layout/qgslayoutscalebarwidget.cpp
Expand Up @@ -514,8 +514,12 @@ void QgsLayoutScaleBarWidget::toggleStyleSpecificControls( const QString &style
if ( style == QLatin1String( "Numeric" ) )
{
//Disable controls which don't apply to numeric scale bars
mGroupBoxUnits->setEnabled( false );
mGroupBoxUnits->setCollapsed( true );
mUnitsComboBox->setEnabled( false );
mUnitsLabel->setEnabled( false );
mMapUnitsPerBarUnitSpinBox->setEnabled( false );
mMapUnitsPerBarUnitLabel->setEnabled( false );
mUnitLabelLineEdit->setEnabled( false );
mUnitLabelLabel->setEnabled( false );
mGroupBoxSegments->setEnabled( false );
mGroupBoxSegments->setCollapsed( true );
mLabelBarSpaceSpinBox->setEnabled( false );
Expand All @@ -532,7 +536,12 @@ void QgsLayoutScaleBarWidget::toggleStyleSpecificControls( const QString &style
else
{
//Enable controls
mGroupBoxUnits->setEnabled( true );
mUnitsComboBox->setEnabled( true );
mUnitsLabel->setEnabled( true );
mMapUnitsPerBarUnitSpinBox->setEnabled( true );
mMapUnitsPerBarUnitLabel->setEnabled( true );
mUnitLabelLineEdit->setEnabled( true );
mUnitLabelLabel->setEnabled( true );
mGroupBoxSegments->setEnabled( true );
mLabelBarSpaceSpinBox->setEnabled( true );
mLineWidthSpinBox->setEnabled( true );
Expand Down
79 changes: 41 additions & 38 deletions src/ui/layout/qgslayoutscalebarwidgetbase.ui
Expand Up @@ -134,36 +134,29 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0">
<item row="1" column="0">
<widget class="QLabel" name="mMapUnitsPerBarUnitLabel">
<item row="2" column="0">
<widget class="QLabel" name="mUnitLabelLabel">
<property name="text">
<string>Label unit multiplier</string>
<string>&amp;Label for units</string>
</property>
<property name="wordWrap">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mMapUnitsPerBarUnitSpinBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mUnitsComboBox">
<property name="toolTip">
<string>Specifies the underlying units used for scalebar calculations, e.g., &quot;meters&quot; or &quot;feet&quot;</string>
<cstring>mUnitLabelLineEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mUnitLabelLabel">
<item row="1" column="0">
<widget class="QLabel" name="mMapUnitsPerBarUnitLabel">
<property name="text">
<string>&amp;Label for units</string>
<string>Label unit multiplier</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mUnitLabelLineEdit</cstring>
<cstring>mMapUnitsPerBarUnitSpinBox</cstring>
</property>
</widget>
</item>
Expand All @@ -183,8 +176,15 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mUnitsComboBox">
<property name="toolTip">
<string>Specifies the underlying units used for scalebar calculations, e.g., &quot;meters&quot; or &quot;feet&quot;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<widget class="QLabel" name="mUnitsLabel">
<property name="text">
<string>Scalebar units</string>
</property>
Expand All @@ -197,6 +197,26 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mUnitLabelLabel_2">
<property name="text">
<string>Number format</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mUnitLabelLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="mNumberFormatPushButton">
<property name="text">
<string>Customize</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -468,26 +488,6 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QPushButton" name="mNumberFormatPushButton">
<property name="text">
<string>Customize</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mUnitLabelLabel_2">
<property name="text">
<string>Number format</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mUnitLabelLineEdit</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -748,6 +748,7 @@
<tabstop>mUnitsComboBox</tabstop>
<tabstop>mMapUnitsPerBarUnitSpinBox</tabstop>
<tabstop>mUnitLabelLineEdit</tabstop>
<tabstop>mNumberFormatPushButton</tabstop>
<tabstop>mGroupBoxSegments</tabstop>
<tabstop>mSegmentsLeftSpinBox</tabstop>
<tabstop>mNumberOfSegmentsSpinBox</tabstop>
Expand All @@ -773,6 +774,8 @@
<tabstop>mFillColor2DDBtn</tabstop>
<tabstop>mStrokeColorButton</tabstop>
<tabstop>mLineColorDDBtn</tabstop>
<tabstop>mLabelHorizontalPlacementComboBox</tabstop>
<tabstop>mLabelVerticalPlacementComboBox</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down

0 comments on commit 4391fe7

Please sign in to comment.