S
S
Sasha Tsikhun2020-12-15 13:13:12
Python
Sasha Tsikhun, 2020-12-15 13:13:12

How to search for entered value in QTableWidget?

I enter the value that I want to find, and it seems to be added again.
Before 5fd88b8511a5b187017080.png
After: 5fd88bbf1d16e978146426.png
Code:

def Search(self):
    db = sqlite3.connect('tableDB.db')
    cursor = db.cursor()
    nbr = self.lineEdit.text()
    content = 'SELECT * FROM information WHERE Password = ?'
    res = cursor.execute(content, [nbr])
    for row_index, row_data in enumerate(res):
      self.tableWidget.insertRow(row_index)
      for colm_index, colm_data in enumerate(row_data):
        self.tableWidget.setItem(row_index, colm_index,QTableWidgetItem(str(colm_data)))

Or tell me how it can be possible to sort immediately (so as not to enter a whole line, but only a letter)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question