Skip to content

Commit

Permalink
[composer] More tweaks to grid UI:
Browse files Browse the repository at this point in the history
- show grid name in draw grid checkbox to aid UX
- restore 12 decimal places for grid interval/offset
- rearrange controls for improved user flow
- disabled cross width control when grid type is not set to cross
- switch to collapsible group boxes
  • Loading branch information
nyalldawson committed Jul 13, 2014
1 parent 4e62dde commit a44e48c
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 63 deletions.
15 changes: 15 additions & 0 deletions src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -1203,6 +1203,11 @@ void QgsComposerMapWidget::on_mGridListWidget_itemChanged( QListWidgetItem* item
}

grid->setName( item->text() );
if ( item->isSelected() )
{
//update check box title if item is current item
mGridCheckBox->setTitle( QString( tr( "Draw \"%1\" grid" ) ).arg( grid->name() ) );
}
}

void QgsComposerMapWidget::setGridItemsEnabled( bool enabled )
Expand Down Expand Up @@ -1267,6 +1272,8 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
}

blockGridItemsSignals( true );

mGridCheckBox->setTitle( QString( tr( "Draw \"%1\" grid" ) ).arg( grid->name() ) );
mGridCheckBox->setChecked( grid->gridEnabled() );
mIntervalXSpinBox->setValue( grid->gridIntervalX() );
mIntervalYSpinBox->setValue( grid->gridIntervalY() );
Expand All @@ -1283,10 +1290,14 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
if ( gridStyle == QgsComposerMap::Cross )
{
mGridTypeComboBox->setCurrentIndex( mGridTypeComboBox->findText( tr( "Cross" ) ) );
mCrossWidthSpinBox->setEnabled( true );
mCrossWidthLabel->setEnabled( true );
}
else
{
mGridTypeComboBox->setCurrentIndex( mGridTypeComboBox->findText( tr( "Solid" ) ) );
mCrossWidthSpinBox->setEnabled( false );
mCrossWidthLabel->setEnabled( false );
}

//grid frame
Expand Down Expand Up @@ -1606,10 +1617,14 @@ void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QStri
if ( text == tr( "Cross" ) )
{
grid->setGridStyle( QgsComposerMap::Cross );
mCrossWidthSpinBox->setEnabled( true );
mCrossWidthLabel->setEnabled( true );
}
else
{
grid->setGridStyle( QgsComposerMap::Solid );
mCrossWidthSpinBox->setEnabled( false );
mCrossWidthLabel->setEnabled( false );
}
mComposerMap->update();
mComposerMap->endCommand();
Expand Down
137 changes: 74 additions & 63 deletions src/ui/qgscomposermapwidgetbase.ui
Expand Up @@ -54,7 +54,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-387</y>
<y>-623</y>
<width>439</width>
<height>1944</height>
</rect>
Expand Down Expand Up @@ -474,7 +474,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="mGridCheckBox">
<widget class="QgsCollapsibleGroupBoxBasic" name="mGridCheckBox">
<property name="title">
<string>Draw grid</string>
</property>
Expand All @@ -488,7 +488,7 @@
<string notr="true">composeritem</string>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down Expand Up @@ -519,6 +519,46 @@
<widget class="QComboBox" name="mGridTypeComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mMapGridCRSLabel">
<property name="text">
<string>CRS</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="mMapGridCRSButton">
<property name="text">
<string>change...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mMapGridUnitLabel">
<property name="text">
<string>Interval units</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mMapGridUnitComboBox">
<item>
<property name="text">
<string>Map unit</string>
</property>
</item>
<item>
<property name="text">
<string>Millimeter</string>
</property>
</item>
<item>
<property name="text">
<string>Centimeter</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mIntervalXLabel_2">
<property name="text">
<string>Interval</string>
Expand All @@ -528,15 +568,15 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QDoubleSpinBox" name="mIntervalXSpinBox">
<property name="prefix">
<string>X </string>
</property>
<property name="decimals">
<number>5</number>
<number>12</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
Expand All @@ -549,7 +589,7 @@
<string>Y </string>
</property>
<property name="decimals">
<number>5</number>
<number>12</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
Expand All @@ -558,7 +598,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="mOffsetXLabel_2">
<property name="text">
<string>Offset</string>
Expand All @@ -568,15 +608,15 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QDoubleSpinBox" name="mOffsetXSpinBox">
<property name="prefix">
<string>X </string>
</property>
<property name="decimals">
<number>5</number>
<number>12</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
Expand All @@ -589,7 +629,7 @@
<string>Y </string>
</property>
<property name="decimals">
<number>5</number>
<number>12</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
Expand All @@ -598,8 +638,8 @@
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mCrossWidthLabel_2">
<item row="5" column="0">
<widget class="QLabel" name="mCrossWidthLabel">
<property name="text">
<string>Cross width</string>
</property>
Expand All @@ -608,14 +648,17 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="mCrossWidthSpinBox">
<property name="suffix">
<string> mm</string>
</property>
<property name="decimals">
<number>5</number>
<number>2</number>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="mLineStyleLabel_2">
<property name="text">
<string>Line style</string>
Expand All @@ -625,67 +668,27 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QPushButton" name="mGridLineStyleButton">
<property name="text">
<string>change...</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="mGridBlendLabel">
<property name="text">
<string>Blend mode</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QgsBlendModeComboBox" name="mGridBlendComboBox"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="mMapGridCRSLabel">
<property name="text">
<string>CRS</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="mMapGridCRSButton">
<property name="text">
<string>change...</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="mMapGridUnitLabel">
<property name="text">
<string>Unit</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="mMapGridUnitComboBox">
<item>
<property name="text">
<string>Map unit</string>
</property>
</item>
<item>
<property name="text">
<string>Millimeter</string>
</property>
</item>
<item>
<property name="text">
<string>Centimeter</string>
</property>
</item>
</widget>
<widget class="QgsBlendModeComboBox" name="mGridBlendComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="mGridFrameGroupBox">
<widget class="QgsCollapsibleGroupBoxBasic" name="mGridFrameGroupBox">
<property name="title">
<string>Grid frame</string>
</property>
Expand Down Expand Up @@ -760,7 +763,11 @@
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox">
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mFramePenLabel">
Expand All @@ -773,7 +780,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="mDrawAnnotationGroupBox">
<widget class="QgsCollapsibleGroupBoxBasic" name="mDrawAnnotationGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
Expand All @@ -790,7 +797,7 @@
<string/>
</property>
<property name="collapsed" stdset="0">
<bool>true</bool>
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="leftMargin">
Expand Down Expand Up @@ -927,7 +934,11 @@
</widget>
</item>
<item row="11" column="1">
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox">
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="mCoordinatePrecisionLabel">
Expand Down

0 comments on commit a44e48c

Please sign in to comment.