Skip to content

Commit

Permalink
[DXF] add (un)select all buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 9, 2013
1 parent c610f37 commit 3f37d24
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 12 deletions.
14 changes: 14 additions & 0 deletions src/app/qgsdxfexportdialog.cpp
Expand Up @@ -11,6 +11,8 @@ QgsDxfExportDialog::QgsDxfExportDialog( const QList<QgsMapLayer*>& layerKeys, QW
setupUi( this );
connect( mFileLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( setOkEnabled() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) );
connect( mSelectAllButton, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
connect( mUnSelectAllButton, SIGNAL( clicked() ), this, SLOT( unSelectAll() ) );

QList<QgsMapLayer*>::const_iterator layerIt = layerKeys.constBegin();
for ( ; layerIt != layerKeys.constEnd(); ++layerIt )
Expand Down Expand Up @@ -43,6 +45,18 @@ QgsDxfExportDialog::~QgsDxfExportDialog()

}

void QgsDxfExportDialog::selectAll()
{
for ( int r = 0; r < mLayersListWidget->count(); r++ )
mLayersListWidget->item( r )->setCheckState( Qt::Checked );
}

void QgsDxfExportDialog::unSelectAll()
{
for ( int r = 0; r < mLayersListWidget->count(); r++ )
mLayersListWidget->item( r )->setCheckState( Qt::Unchecked );
}

QList<QString> QgsDxfExportDialog::layers() const
{
QList<QString> layerKeyList;
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsdxfexportdialog.h
Expand Up @@ -16,6 +16,11 @@ class QgsDxfExportDialog: public QDialog, private Ui::QgsDxfExportDialogBase
QgsDxfExport::SymbologyExport symbologyMode() const;
QString saveFile() const;

public slots:
/** change the selection of layers in the list */
void selectAll();
void unSelectAll();

private slots:
void on_mFileSelectionButton_clicked();
void setOkEnabled();
Expand Down
55 changes: 43 additions & 12 deletions src/ui/qgsdxfexportdialogbase.ui
Expand Up @@ -14,7 +14,17 @@
<string>DXF export</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="4" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="mFileLineEdit"/>
Expand Down Expand Up @@ -74,15 +84,36 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPushButton" name="mSelectAllButton">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="mUnSelectAllButton">
<property name="text">
<string>Unselet all</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
Expand All @@ -95,8 +126,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
<x>263</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
Expand Down

0 comments on commit 3f37d24

Please sign in to comment.