Skip to content
Permalink
Browse files

Revert "[composer] Add an apply button for atlas settings, prevents"

This reverts commit 7934a92.

Change proved to have little value and was too easy to overlook.
  • Loading branch information
nyalldawson committed Sep 28, 2015
1 parent 8a9009d commit b713b4a4c3e9c6026e62476688a57b40d6bbb6b8
@@ -45,7 +45,9 @@ QgsAtlasCompositionWidget::QgsAtlasCompositionWidget( QWidget* parent, QgsCompos
mAtlasCoverageLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );

connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mAtlasSortFeatureKeyComboBox, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), mPageNameWidget, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mAtlasCoverageLayerComboBox, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( changeCoverageLayer( QgsMapLayer* ) ) );
connect( mAtlasSortFeatureKeyComboBox, SIGNAL( fieldChanged( QString ) ), this, SLOT( changesSortFeatureField( QString ) ) );
connect( mPageNameWidget, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( pageNameExpressionChanged( QString, bool ) ) );

// Sort direction
mAtlasSortFeatureDirectionButton->setEnabled( false );
@@ -80,6 +82,27 @@ void QgsAtlasCompositionWidget::on_mUseAtlasCheckBox_stateChanged( int state )
}
}

void QgsAtlasCompositionWidget::changeCoverageLayer( QgsMapLayer *layer )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
{
return;
}

QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer );

if ( !vl )
{
atlasMap->setCoverageLayer( 0 );
}
else
{
atlasMap->setCoverageLayer( vl );
updateAtlasFeatures();
}
}

void QgsAtlasCompositionWidget::on_mAtlasFilenamePatternEdit_editingFinished()
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -133,6 +156,16 @@ void QgsAtlasCompositionWidget::on_mAtlasFilenameExpressionButton_clicked()
}
}

void QgsAtlasCompositionWidget::on_mAtlasHideCoverageCheckBox_stateChanged( int state )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
{
return;
}
atlasMap->setHideCoverage( state == Qt::Checked );
}

void QgsAtlasCompositionWidget::on_mAtlasSingleFileCheckBox_stateChanged( int state )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
@@ -155,6 +188,12 @@ void QgsAtlasCompositionWidget::on_mAtlasSingleFileCheckBox_stateChanged( int st

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

if ( state == Qt::Checked )
{
mAtlasSortFeatureDirectionButton->setEnabled( true );
@@ -165,6 +204,8 @@ void QgsAtlasCompositionWidget::on_mAtlasSortFeatureCheckBox_stateChanged( int s
mAtlasSortFeatureDirectionButton->setEnabled( false );
mAtlasSortFeatureKeyComboBox->setEnabled( false );
}
atlasMap->setSortFeatures( state == Qt::Checked );
updateAtlasFeatures();
}

void QgsAtlasCompositionWidget::updateAtlasFeatures()
@@ -190,12 +231,31 @@ void QgsAtlasCompositionWidget::updateAtlasFeatures()
QMessageBox::Ok,
QMessageBox::Ok );

//Perhaps atlas preview should be disabled now? If so, it may get annoying if user is editing
//the filter expression and it keeps disabling itself.
return;
}
}

void QgsAtlasCompositionWidget::changesSortFeatureField( QString fieldName )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
{
return;
}
atlasMap->setSortKeyAttributeName( fieldName );
updateAtlasFeatures();
}

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

if ( state == Qt::Checked )
{
mAtlasFeatureFilterEdit->setEnabled( true );
@@ -206,36 +266,30 @@ void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterCheckBox_stateChanged( int
mAtlasFeatureFilterEdit->setEnabled( false );
mAtlasFeatureFilterButton->setEnabled( false );
}
atlasMap->setFilterFeatures( state == Qt::Checked );
updateAtlasFeatures();
}

void QgsAtlasCompositionWidget::on_mApplyConfigButton_clicked()
void QgsAtlasCompositionWidget::pageNameExpressionChanged( QString expression, bool valid )
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
if ( !atlasMap || ( !valid && !expression.isEmpty() ) )
{
return;
}

QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mAtlasCoverageLayerComboBox->currentLayer() );
if ( !vl )
{
atlasMap->setCoverageLayer( 0 );
}
else
atlasMap->setPageNameExpression( expression );
}

void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterEdit_editingFinished()
{
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
if ( !atlasMap )
{
atlasMap->setCoverageLayer( vl );
return;
}

atlasMap->setSortFeatures( mAtlasSortFeatureCheckBox->isChecked() );
atlasMap->setSortKeyAttributeName( mAtlasSortFeatureKeyComboBox->currentField() );
Qt::ArrowType at = mAtlasSortFeatureDirectionButton->arrowType();
at = ( at == Qt::UpArrow ) ? Qt::DownArrow : Qt::UpArrow;
atlasMap->setSortAscending( at == Qt::UpArrow );
atlasMap->setFilterFeatures( mAtlasFeatureFilterCheckBox->isChecked() );
atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() );
atlasMap->setPageNameExpression( mPageNameWidget->currentField() );
atlasMap->setHideCoverage( mAtlasHideCoverageCheckBox->isChecked() );

updateAtlasFeatures();
}

@@ -259,6 +313,8 @@ void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterButton_clicked()
if ( !expression.isEmpty() )
{
mAtlasFeatureFilterEdit->setText( expression );
atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() );
updateAtlasFeatures();
}
}
}
@@ -268,6 +324,15 @@ 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 );
updateAtlasFeatures();
}

void QgsAtlasCompositionWidget::updateGuiElements()
@@ -36,15 +36,19 @@ class QgsAtlasCompositionWidget:

public slots:
void on_mUseAtlasCheckBox_stateChanged( int state );
void changeCoverageLayer( QgsMapLayer* layer );
void on_mAtlasFilenamePatternEdit_editingFinished();
void on_mAtlasFilenameExpressionButton_clicked();
void on_mAtlasHideCoverageCheckBox_stateChanged( int state );
void on_mAtlasSingleFileCheckBox_stateChanged( int state );

void on_mAtlasSortFeatureCheckBox_stateChanged( int state );
void changesSortFeatureField( QString fieldName );
void on_mAtlasSortFeatureDirectionButton_clicked();
void on_mAtlasFeatureFilterEdit_editingFinished();
void on_mAtlasFeatureFilterButton_clicked();
void on_mAtlasFeatureFilterCheckBox_stateChanged( int state );
void on_mApplyConfigButton_clicked();
void pageNameExpressionChanged( QString expression, bool valid );

private slots:
void updateGuiElements();
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>310</width>
<height>381</height>
<width>435</width>
<height>596</height>
</rect>
</property>
<property name="sizePolicy">
@@ -111,8 +111,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>306</width>
<height>352</height>
<width>431</width>
<height>567</height>
</rect>
</property>
<layout class="QVBoxLayout" name="mainLayout">
@@ -139,7 +139,7 @@
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
<item row="4" column="2">
<widget class="QToolButton" name="mAtlasSortFeatureDirectionButton">
<property name="toolTip">
@@ -237,30 +237,6 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="mApplyConfigButton">
<property name="text">
<string>Apply configuration</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@@ -342,7 +318,7 @@
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header location="global">qgscollapsiblegroupbox.h</header>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
@@ -363,17 +339,12 @@
</customwidgets>
<tabstops>
<tabstop>mUseAtlasCheckBox</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>mConfigurationGroup</tabstop>
<tabstop>mAtlasCoverageLayerComboBox</tabstop>
<tabstop>mAtlasHideCoverageCheckBox</tabstop>
<tabstop>mAtlasFeatureFilterCheckBox</tabstop>
<tabstop>mAtlasFeatureFilterEdit</tabstop>
<tabstop>mAtlasFeatureFilterButton</tabstop>
<tabstop>mAtlasSortFeatureCheckBox</tabstop>
<tabstop>mAtlasSortFeatureKeyComboBox</tabstop>
<tabstop>mAtlasSortFeatureDirectionButton</tabstop>
<tabstop>mApplyConfigButton</tabstop>
<tabstop>mOutputGroup</tabstop>
<tabstop>mAtlasFilenamePatternEdit</tabstop>
<tabstop>mAtlasFilenameExpressionButton</tabstop>

0 comments on commit b713b4a

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