my general idea is like this when I want to modify the value in my table I search for it first (box N01 in image), maybe it will give me only one value or 2.

in the case of only one value it will be easy to fix.

in case of 2 value my idea is when I click on box N2 (in image) it retrieve data (probably the id value, because it will make it easy).

and when I click on the modifier (box N 3 on the image) it show me the value in each lineEdit (that's an easy part)


KJHAM.jpg


so my problem is when I click on the table (on bok 2 in image) its take on data at all.

this is my code for the search part:

Qt Code:
  1. def show_mod_RDV(self):
  2. rdv_search = self.lineEdit_7.text()
  3. rdv_search_date = self.dateEdit_5.text()
  4.  
  5. conn = sqlite3.connect('rdv_database.db')
  6. c = conn.cursor()
  7. result_M = c.execute("SELECT * FROM rdv_data WHERE name LIKE ? AND date LIKE ? ", (rdv_search, rdv_search_date) ).fetchall()
  8. print(result_M)
  9.  
  10. self.tableWidget_3.clearContents()
  11. if result_M:
  12. self.tableWidget_3.setRowCount(0)
  13. self.tableWidget_3.insertRow(0)
  14. for row , form in enumerate(result_M):
  15. for colum, item in enumerate(form):
  16. self.tableWidget_3.setItem(row, colum, QTableWidgetItem(str(item)))
  17. #colum +=1
  18. row_position = self.tableWidget_3.rowCount()
  19. self.tableWidget_3.insertRow(row_position)
To copy to clipboard, switch view to plain text mode 

and for the part of retrieving data from table is:

Qt Code:
  1. def cell_was_clicked(self, row, column):
  2. print("Row %d and Column %d was clicked" % (row, column))
  3. id_tab = self.tableWidget_3.currentColumn()
  4. id_tab_clic = self.tableWidget_3.currentRow()
  5. print (f' id tab is {id_tab}')
  6. print (f' id tab_cl is {id_tab_clic}')
To copy to clipboard, switch view to plain text mode 

this code shows me the row and the column that I clicked, the current column and the current row, but it did not take any real value from table.

is there any way to take value from this table or is there another better way that will be very helpful