Skip to content

Commit 00618fc

Browse files
author
Hugo Mercier
committedMay 4, 2015
[DBManager] Allow non-spatial layers
1 parent 72eb1aa commit 00618fc

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed
 

‎python/plugins/db_manager/dlg_sql_window.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,13 @@ def executeSql(self):
179179

180180
def loadSqlLayer(self):
181181
uniqueFieldName = self.uniqueCombo.currentText()
182-
geomFieldName = self.geomCombo.currentText()
182+
hasGeomCol = self.hasGeometryCol.checkState() == Qt.Checked
183+
if hasGeomCol:
184+
geomFieldName = self.geomCombo.currentText()
185+
else:
186+
geomFieldName = None
183187

184-
if geomFieldName == "" or uniqueFieldName == "":
188+
if (hasGeomCol and geomFieldName == "") or uniqueFieldName == "":
185189
QMessageBox.warning(self, self.tr("DB Manager"), self.tr(
186190
"You must fill the required fields: \ngeometry column - column with unique integer values"))
187191
return

‎python/plugins/db_manager/ui/DlgSqlWindow.ui

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,15 @@ integer values</string>
205205
</widget>
206206
</item>
207207
<item>
208-
<widget class="QLabel" name="label_3">
208+
<widget class="QCheckBox" name="hasGeometryCol">
209209
<property name="text">
210210
<string>Geometry column</string>
211211
</property>
212-
<property name="indent">
213-
<number>40</number>
212+
<property name="checked">
213+
<bool>true</bool>
214+
</property>
215+
<property name="tristate">
216+
<bool>false</bool>
214217
</property>
215218
</widget>
216219
</item>
@@ -384,5 +387,21 @@ columns</string>
384387
</hint>
385388
</hints>
386389
</connection>
390+
<connection>
391+
<sender>hasGeometryCol</sender>
392+
<signal>toggled(bool)</signal>
393+
<receiver>geomCombo</receiver>
394+
<slot>setEnabled(bool)</slot>
395+
<hints>
396+
<hint type="sourcelabel">
397+
<x>379</x>
398+
<y>385</y>
399+
</hint>
400+
<hint type="destinationlabel">
401+
<x>525</x>
402+
<y>385</y>
403+
</hint>
404+
</hints>
405+
</connection>
387406
</connections>
388407
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.