Skip to content
Permalink
Browse files

Add skip all option to merge attributes dialog (fix #6958)

  • Loading branch information
nyalldawson committed Oct 19, 2015
1 parent 0bda18b commit 23dd501650f7840f68a2a96727275c9f36d8ac20
@@ -6142,6 +6142,8 @@ void QgisApp::mergeAttributesOfSelectedFeatures()

//merge the attributes together
QgsMergeAttributesDialog d( featureList, vl, mapCanvas() );
//intialise dialog with all columns set to skip
d.setAllToSkip();
if ( d.exec() == QDialog::Rejected )
{
return;
@@ -53,6 +53,8 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur

QSettings settings;
restoreGeometry( settings.value( "/Windows/MergeAttributes/geometry" ).toByteArray() );

connect( mSkipAllButton, SIGNAL( clicked() ), this, SLOT( setAllToSkip() ) );
}

QgsMergeAttributesDialog::QgsMergeAttributesDialog()
@@ -636,3 +638,15 @@ QSet<int> QgsMergeAttributesDialog::skippedAttributeIndexes() const

return skipped;
}

void QgsMergeAttributesDialog::setAllToSkip()
{
for ( int i = 0; i < mTableWidget->columnCount(); ++i )
{
QComboBox* currentComboBox = qobject_cast<QComboBox *>( mTableWidget->cellWidget( 0, i ) );
if ( currentComboBox )
{
currentComboBox->setCurrentIndex( currentComboBox->findData( "skip" ) );
}
}
}
@@ -35,13 +35,20 @@ class APP_EXPORT QgsMergeAttributesDialog: public QDialog, private Ui::QgsMergeA
public:
QgsMergeAttributesDialog( const QgsFeatureList& features, QgsVectorLayer* vl, QgsMapCanvas* canvas, QWidget * parent = 0, Qt::WindowFlags f = 0 );
~QgsMergeAttributesDialog();

QgsAttributes mergedAttributes() const;

/** Returns a list of attribute indexes which should be skipped when merging (eg, attributes
* which have been set to "skip"
*/
QSet<int> skippedAttributeIndexes() const;

public slots:

/** Resets all columns to "skip"
*/
void setAllToSkip();

private slots:
void comboValueChanged( const QString & text );
void selectedRowChanged();
@@ -57,7 +57,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="mRemoveFeatureFromSelectionButton">
@@ -91,7 +91,7 @@
</item>
</layout>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -101,15 +101,59 @@
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="mSkipAllButton">
<property name="toolTip">
<string>Resets all fields to &quot;Skip&quot;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionSelectPan.png</normaloff>:/images/themes/default/mActionSelectPan.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mRemoveFeatureFromSelectionLabel_2">
<property name="text">
<string>Skip all fields</string>
</property>
<property name="buddy">
<cstring>mRemoveFeatureFromSelectionButton</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>98</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>mTableWidget</tabstop>
<tabstop>mFromSelectedPushButton</tabstop>
<tabstop>mSkipAllButton</tabstop>
<tabstop>mRemoveFeatureFromSelectionButton</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../images/images.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>

0 comments on commit 23dd501

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