mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[db-manager] Update sql dialog buttons status
Fixes #19958 - Database manager allows one to create saved query with no name
This commit is contained in:
parent
94ded32f4e
commit
c06c475b9c
@ -116,6 +116,10 @@ class DlgSqlLayerWindow(QWidget, Ui_Dialog):
|
||||
self.presetCombo.activated[str].connect(self.loadPreset)
|
||||
self.presetCombo.activated[str].connect(self.presetName.setText)
|
||||
|
||||
self.editSql.textChanged.connect(self.updatePresetButtonsState)
|
||||
self.presetName.textChanged.connect(self.updatePresetButtonsState)
|
||||
self.presetCombo.currentIndexChanged.connect(self.updatePresetButtonsState)
|
||||
|
||||
self.updatePresetsCombobox()
|
||||
|
||||
self.geomCombo.setEditable(True)
|
||||
@ -186,6 +190,12 @@ class DlgSqlLayerWindow(QWidget, Ui_Dialog):
|
||||
def getQueryHash(self, name):
|
||||
return 'q%s' % md5(name.encode('utf8')).hexdigest()
|
||||
|
||||
def updatePresetButtonsState(self, *args):
|
||||
"""Slot called when the combo box or the sql or the query name have changed:
|
||||
sets store button state"""
|
||||
self.presetStore.setEnabled(bool(self._getSqlQuery() and self.presetName.text()))
|
||||
self.presetDelete.setEnabled(bool(self.presetCombo.currentIndex() != -1))
|
||||
|
||||
def updatePresetsCombobox(self):
|
||||
self.presetCombo.clear()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user