modify queryline as select and editable combobox

This commit is contained in:
ccppi 2024-08-08 13:02:26 +02:00
parent f1baa3f49b
commit 345490c2e0

View File

@ -120,7 +120,12 @@ class MainWindow(QMainWindow):
self.browser = QWebEngineView()
self.browser.setUrl(QUrl("https://jobagent.ch"))
self.EditQuery = QLineEdit()
#self.EditQuery = QLineEdit()
self.CEditQuery = QComboBox()
self.CEditQuery.setEditable(True)
self.CEditQuery.setInsertPolicy(QComboBox.InsertAtBottom)
self.queryFineFilers()
self.EditQuery = self.CEditQuery.lineEdit()
self.EditQuery.returnPressed.connect(self.queryEditLine)
editables = {0 : ("UPDATE jobs SET star = '{}' WHERE hash = '{}'",7)}
@ -146,7 +151,7 @@ class MainWindow(QMainWindow):
self.layout.addWidget(self.view)
self.layout.addWidget(self.b_canton)
self.layout.addWidget(self.EditQuery)
self.layout.addWidget(self.CEditQuery)
self.layout.addWidget(self.PsyncDB)
self.layout.addWidget(self.PValidate)
self.layout2.addLayout(self.layout)
@ -261,6 +266,18 @@ class MainWindow(QMainWindow):
self.view.selectionModel().currentIndex()
self.model.setData({0,8},hash1,role=1001)
def queryFineFilers(self):
FineFilterItems = self.getFineFilters()
for item in FineFilterItems:
self.CEditQuery.addItem(item)
def getFineFilters(self):
item = []
statement = f"""Select cmd FROM filters;"""
query = QSqlQuery(statement)
while query.next():
item.append(query.value(0))
return item
def customSQL(self,cmd):
print("Run SQL Query",cmd)
#self.model.setTable("")