Skip to content
Permalink
Browse files
[Atlas] Replace the sort direction combobox by a up/down button
  • Loading branch information
Hugo Mercier committed Feb 7, 2013
1 parent 915493c commit d1a05f756551d5592ba3ee073627ebf77d05ea97
Showing with 56 additions and 36 deletions.
  1. +18 −19 src/app/composer/qgsatlascompositionwidget.cpp
  2. +1 −1 src/app/composer/qgsatlascompositionwidget.h
  3. +37 −16 src/ui/qgsatlascompositionwidgetbase.ui
@@ -61,9 +61,7 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
}

// Sort direction
mAtlasSortFeatureDirectionComboBox->insertItem( 0, tr("Ascending") );
mAtlasSortFeatureDirectionComboBox->insertItem( 1, tr("Descending") );
mAtlasSortFeatureDirectionComboBox->setEnabled( false );
mAtlasSortFeatureDirectionButton->setEnabled( false );

mAtlasSortFeatureKeyComboBox->setEnabled( false );

@@ -289,11 +287,11 @@ void QgsAtlasCompositionWidget::on_mAtlasSortFeatureCheckBox_stateChanged( int s
}

if ( state == Qt::Checked ) {
mAtlasSortFeatureDirectionComboBox->setEnabled( true );
mAtlasSortFeatureDirectionButton->setEnabled( true );
mAtlasSortFeatureKeyComboBox->setEnabled( true );
}
else {
mAtlasSortFeatureDirectionComboBox->setEnabled( false );
mAtlasSortFeatureDirectionButton->setEnabled( false );
mAtlasSortFeatureKeyComboBox->setEnabled( false );
}
atlasMap->setSortFeatures( state == Qt::Checked );
@@ -312,19 +310,6 @@ void QgsAtlasCompositionWidget::on_mAtlasSortFeatureKeyComboBox_currentIndexChan
}
}

void QgsAtlasCompositionWidget::on_mAtlasSortFeatureDirectionComboBox_currentIndexChanged( int index )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
{
return;
}

if ( index != -1 ) {
atlasMap->setSortAscending( index == 0 ? true : false );
}
}

void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterEdit_textChanged( const QString& text )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -357,6 +342,20 @@ void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterButton_clicked()
}
}

void QgsAtlasCompositionWidget::on_mAtlasSortFeatureDirectionButton_clicked()
{
Qt::ArrowType at = mAtlasSortFeatureDirectionButton->arrowType();
at = (at == Qt::UpArrow) ? Qt::DownArrow : Qt::UpArrow;
mAtlasSortFeatureDirectionButton->setArrowType( at );

QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap ) {
return;
}

atlasMap->setSortAscending( at == Qt::UpArrow );
}

void QgsAtlasCompositionWidget::fillSortColumns()
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -403,7 +402,7 @@ void QgsAtlasCompositionWidget::updateGuiElements()
mAtlasSingleFileCheckBox->setCheckState( atlasMap->singleFile() ? Qt::Checked : Qt::Unchecked );
mAtlasSortFeatureCheckBox->setCheckState( atlasMap->sortFeatures() ? Qt::Checked : Qt::Unchecked );
mAtlasSortFeatureKeyComboBox->setCurrentIndex( atlasMap->sortKeyAttributeIndex() );
mAtlasSortFeatureDirectionComboBox->setCurrentIndex( atlasMap->sortAscending() ? 0 : 1 );
mAtlasSortFeatureDirectionButton->setArrowType( atlasMap->sortAscending() ? Qt::UpArrow : Qt::DownArrow );
mAtlasFeatureFilterEdit->setText( atlasMap->featureFilter() );
}

@@ -45,7 +45,7 @@ class QgsAtlasCompositionWidget:

void on_mAtlasSortFeatureCheckBox_stateChanged( int state );
void on_mAtlasSortFeatureKeyComboBox_currentIndexChanged( int index );
void on_mAtlasSortFeatureDirectionComboBox_currentIndexChanged( int index );
void on_mAtlasSortFeatureDirectionButton_clicked();
void on_mAtlasFeatureFilterEdit_textChanged( const QString& text );
void on_mAtlasFeatureFilterButton_clicked();

@@ -75,8 +75,8 @@
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_7" rowstretch="0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0">
<item row="5" column="0">
<layout class="QGridLayout" name="gridLayout_7" rowstretch="0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0">
<item row="4" column="0">
<widget class="QLabel" name="mAtlasFeatureFilterLabel">
<property name="text">
<string>Feature filter</string>
@@ -93,21 +93,21 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Margin around coverage</string>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output filename expression</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="5" column="1">
<widget class="QSpinBox" name="mAtlasMarginSpinBox">
<property name="suffix">
<string> %</string>
@@ -120,14 +120,14 @@
</property>
</widget>
</item>
<item row="9" column="2">
<item row="8" column="2">
<widget class="QToolButton" name="mAtlasFilenameExpressionButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<widget class="QLineEdit" name="mAtlasFilenamePatternEdit"/>
</item>
<item row="1" column="0">
@@ -144,14 +144,14 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="mAtlasFixedScaleCheckBox">
<property name="text">
<string>Fixed scale</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="mAtlasSingleFileCheckBox">
<property name="text">
<string>Single file export when possible</string>
@@ -169,7 +169,18 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="mAtlasSortFeatureKeyComboBox"/>
<widget class="QComboBox" name="mAtlasSortFeatureKeyComboBox">
<property name="toolTip">
<string>Sort key</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="mAtlasFeatureFilterEdit">
<property name="toolTip">
<string>Feature filter</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="mAtlasSortFeatureCheckBox">
@@ -178,18 +189,28 @@
</property>
</widget>
</item>
<item row="5" column="2">
<item row="4" column="2">
<widget class="QToolButton" name="mAtlasFeatureFilterButton">
<property name="toolTip">
<string>Open expression builder</string>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="mAtlasFeatureFilterEdit"/>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="mAtlasSortFeatureDirectionComboBox"/>
<item row="3" column="2">
<widget class="QToolButton" name="mAtlasSortFeatureDirectionButton">
<property name="toolTip">
<string>Sort direction</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="arrowType">
<enum>Qt::UpArrow</enum>
</property>
</widget>
</item>
</layout>
</item>

0 comments on commit d1a05f7

Please sign in to comment.