File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
#include " qgsosmdatabase.h"
19
19
20
+ #include " qgsdatasourceuri.h"
21
+ #include " qgsmaplayerregistry.h"
22
+ #include " qgsvectorlayer.h"
23
+
20
24
#include < QApplication>
21
25
#include < QFileDialog>
22
26
#include < QMessageBox>
@@ -148,6 +152,17 @@ void QgsOSMExportDialog::onOK()
148
152
149
153
bool res = mDatabase ->exportSpatiaLite ( type, editLayerName->text (), tagKeys );
150
154
155
+ // load the layer into canvas if that was requested
156
+ if ( chkLoadWhenFinished->isChecked () )
157
+ {
158
+ QgsDataSourceURI uri;
159
+ uri.setDatabase ( editDbFileName->text () );
160
+ uri.setDataSource ( QString (), editLayerName->text (), " geometry" );
161
+ QgsVectorLayer* vlayer = new QgsVectorLayer ( uri.uri (), editLayerName->text (), " spatialite" );
162
+ if ( vlayer->isValid () )
163
+ QgsMapLayerRegistry::instance ()->addMapLayer ( vlayer );
164
+ }
165
+
151
166
QApplication::restoreOverrideCursor ();
152
167
buttonBox->setEnabled ( true );
153
168
Original file line number Diff line number Diff line change 6
6
<rect >
7
7
<x >0</x >
8
8
<y >0</y >
9
- <width >458 </width >
10
- <height >436 </height >
9
+ <width >456 </width >
10
+ <height >434 </height >
11
11
</rect >
12
12
</property >
13
13
<property name =" windowTitle" >
118
118
</layout >
119
119
</widget >
120
120
</item >
121
+ <item >
122
+ <widget class =" QCheckBox" name =" chkLoadWhenFinished" >
123
+ <property name =" text" >
124
+ <string >& Load into canvas when finished</string >
125
+ </property >
126
+ <property name =" checked" >
127
+ <bool >true</bool >
128
+ </property >
129
+ </widget >
130
+ </item >
121
131
<item >
122
132
<layout class =" QHBoxLayout" name =" horizontalLayout_4" >
123
133
<item >
150
160
<tabstop >editLayerName</tabstop >
151
161
<tabstop >btnLoadTags</tabstop >
152
162
<tabstop >viewTags</tabstop >
163
+ <tabstop >chkLoadWhenFinished</tabstop >
153
164
<tabstop >buttonBox</tabstop >
154
165
</tabstops >
155
166
<resources />
You can’t perform that action at this time.
0 commit comments