Python Forum
[PyQt] [Solved]How to check if row is selected and grab Name from row
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] [Solved]How to check if row is selected and grab Name from row
#2
The table is sized down by the number of rows.
If you click on an empty space below it is no longer the table.
The function is therefore only effective if a line within the table is clicked.

If you want the name use column 1

    def getCellText(self):
        if self.InventoryDisplay.selectedIndexes():
            model= self.InventoryDisplay.model()
            row = self.selectedRow()
            column = 1
            name = model.data(model.index(row, column))
            self.sbar.showMessage(str(name))
            print(name)
Reply


Messages In This Thread
RE: How to check if row is selected and grab Name from row - by Axel_Erfurt - Jun-06-2022, 09:22 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020