[DBManager] Allow non-spatial layers

This commit is contained in:
Hugo Mercier 2015-03-26 17:05:53 +01:00
parent 72eb1aae97
commit 00618fcabf
2 changed files with 28 additions and 5 deletions

View File

@ -179,9 +179,13 @@ class DlgSqlWindow(QDialog, Ui_Dialog):
def loadSqlLayer(self):
uniqueFieldName = self.uniqueCombo.currentText()
geomFieldName = self.geomCombo.currentText()
hasGeomCol = self.hasGeometryCol.checkState() == Qt.Checked
if hasGeomCol:
geomFieldName = self.geomCombo.currentText()
else:
geomFieldName = None
if geomFieldName == "" or uniqueFieldName == "":
if (hasGeomCol and geomFieldName == "") or uniqueFieldName == "":
QMessageBox.warning(self, self.tr("DB Manager"), self.tr(
"You must fill the required fields: \ngeometry column - column with unique integer values"))
return

View File

@ -205,12 +205,15 @@ integer values</string>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QCheckBox" name="hasGeometryCol">
<property name="text">
<string>Geometry column</string>
</property>
<property name="indent">
<number>40</number>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
@ -384,5 +387,21 @@ columns</string>
</hint>
</hints>
</connection>
<connection>
<sender>hasGeometryCol</sender>
<signal>toggled(bool)</signal>
<receiver>geomCombo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>379</x>
<y>385</y>
</hint>
<hint type="destinationlabel">
<x>525</x>
<y>385</y>
</hint>
</hints>
</connection>
</connections>
</ui>