Skip to content

Commit 3f37d24

Browse files
committed
[DXF] add (un)select all buttons
1 parent c610f37 commit 3f37d24

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed

src/app/qgsdxfexportdialog.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ QgsDxfExportDialog::QgsDxfExportDialog( const QList<QgsMapLayer*>& layerKeys, QW
1111
setupUi( this );
1212
connect( mFileLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( setOkEnabled() ) );
1313
connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) );
14+
connect( mSelectAllButton, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
15+
connect( mUnSelectAllButton, SIGNAL( clicked() ), this, SLOT( unSelectAll() ) );
1416

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

4446
}
4547

48+
void QgsDxfExportDialog::selectAll()
49+
{
50+
for ( int r = 0; r < mLayersListWidget->count(); r++ )
51+
mLayersListWidget->item( r )->setCheckState( Qt::Checked );
52+
}
53+
54+
void QgsDxfExportDialog::unSelectAll()
55+
{
56+
for ( int r = 0; r < mLayersListWidget->count(); r++ )
57+
mLayersListWidget->item( r )->setCheckState( Qt::Unchecked );
58+
}
59+
4660
QList<QString> QgsDxfExportDialog::layers() const
4761
{
4862
QList<QString> layerKeyList;

src/app/qgsdxfexportdialog.h

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class QgsDxfExportDialog: public QDialog, private Ui::QgsDxfExportDialogBase
1616
QgsDxfExport::SymbologyExport symbologyMode() const;
1717
QString saveFile() const;
1818

19+
public slots:
20+
/** change the selection of layers in the list */
21+
void selectAll();
22+
void unSelectAll();
23+
1924
private slots:
2025
void on_mFileSelectionButton_clicked();
2126
void setOkEnabled();

src/ui/qgsdxfexportdialogbase.ui

+43-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@
1414
<string>DXF export</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_2">
17-
<item row="0" column="0">
17+
<item row="4" column="1">
18+
<widget class="QDialogButtonBox" name="buttonBox">
19+
<property name="orientation">
20+
<enum>Qt::Horizontal</enum>
21+
</property>
22+
<property name="standardButtons">
23+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
24+
</property>
25+
</widget>
26+
</item>
27+
<item row="0" column="0" colspan="3">
1828
<layout class="QGridLayout" name="gridLayout">
1929
<item row="0" column="1">
2030
<widget class="QLineEdit" name="mFileLineEdit"/>
@@ -74,15 +84,36 @@
7484
</item>
7585
</layout>
7686
</item>
77-
<item row="1" column="0">
78-
<widget class="QDialogButtonBox" name="buttonBox">
79-
<property name="orientation">
80-
<enum>Qt::Horizontal</enum>
81-
</property>
82-
<property name="standardButtons">
83-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
84-
</property>
85-
</widget>
87+
<item row="2" column="0" colspan="2">
88+
<layout class="QGridLayout" name="gridLayout_3">
89+
<item row="0" column="0">
90+
<widget class="QPushButton" name="mSelectAllButton">
91+
<property name="text">
92+
<string>Select all</string>
93+
</property>
94+
</widget>
95+
</item>
96+
<item row="0" column="1">
97+
<widget class="QPushButton" name="mUnSelectAllButton">
98+
<property name="text">
99+
<string>Unselet all</string>
100+
</property>
101+
</widget>
102+
</item>
103+
<item row="0" column="2">
104+
<spacer name="horizontalSpacer">
105+
<property name="orientation">
106+
<enum>Qt::Horizontal</enum>
107+
</property>
108+
<property name="sizeHint" stdset="0">
109+
<size>
110+
<width>40</width>
111+
<height>20</height>
112+
</size>
113+
</property>
114+
</spacer>
115+
</item>
116+
</layout>
86117
</item>
87118
</layout>
88119
</widget>
@@ -95,8 +126,8 @@
95126
<slot>accept()</slot>
96127
<hints>
97128
<hint type="sourcelabel">
98-
<x>248</x>
99-
<y>254</y>
129+
<x>263</x>
130+
<y>282</y>
100131
</hint>
101132
<hint type="destinationlabel">
102133
<x>157</x>

0 commit comments

Comments
 (0)