QTableWidget Read Cell Value
-
Hi, I try to make an desktop app that get some values from user and make some calculations and show result.
I prepared my design from QtDesigner, convert design to code and all I want is just get the value from the table cell.Everywhere I research gives the code;
# Get the first column and first row of table self.tableWidget.itemAt(0,0).text()Actually it works. I can get the value of first column and first row.
# Try to get all 6 cells values self.tableWidget.itemAt(0,0).text() self.tableWidget.itemAt(0,1).text() self.tableWidget.itemAt(0,2).text() self.tableWidget.itemAt(1,0).text() self.tableWidget.itemAt(1,1).text() self.tableWidget.itemAt(1,2).text()But when I try to get other 5 cells values, it returns same value.
After some investigation, I found that that itemAt(x,y) values are not indexes. They are pixels.
I try to figure out how it works heuristicly.# this may gives second rows item self.tableWidget.itemAt(20,40).text()Isn't there a way for access the cells other than this weird method?
Actually I don't want to access the cells with pixels, I just want to access them via index.
-
Hi, I try to make an desktop app that get some values from user and make some calculations and show result.
I prepared my design from QtDesigner, convert design to code and all I want is just get the value from the table cell.Everywhere I research gives the code;
# Get the first column and first row of table self.tableWidget.itemAt(0,0).text()Actually it works. I can get the value of first column and first row.
# Try to get all 6 cells values self.tableWidget.itemAt(0,0).text() self.tableWidget.itemAt(0,1).text() self.tableWidget.itemAt(0,2).text() self.tableWidget.itemAt(1,0).text() self.tableWidget.itemAt(1,1).text() self.tableWidget.itemAt(1,2).text()But when I try to get other 5 cells values, it returns same value.
After some investigation, I found that that itemAt(x,y) values are not indexes. They are pixels.
I try to figure out how it works heuristicly.# this may gives second rows item self.tableWidget.itemAt(20,40).text()Isn't there a way for access the cells other than this weird method?
Actually I don't want to access the cells with pixels, I just want to access them via index.