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
#5
(Jun-07-2022, 07:53 AM)Axel_Erfurt Wrote: If you want to select a whole row, use SelectionBehavior

        self.InventoryDisplay = QTableView()
        self.InventoryDisplay.setSelectionBehavior(1)
0 Selecting single items.
1 Selecting only rows.
2 Selecting only columns.


Thanks for this. It's helpful and very useful in my program, but I'm looking to have the program make sure a row is currently selected before a popup window opens.

So if nothing is selected and the user presses a button, a msgBox pops up reminding the user to select a row before clicking the button.
Once the user clicks on a row (the row is currently highlighted) then a different popup window opens.

This is to prevent a crash when the program first opens. Because nothing is selected, If the user hits the checkout button the program will crash because no item is currently selected.

So I need to either check to make sure a row is selected or when the program first opens the first row is selected by default.
Any suggestions on how to do that?

Thanks.
Reply


Messages In This Thread
RE: How to check if row is selected and grab Name from row - by Extra - Jun-07-2022, 11:46 PM

Forum Jump:

User Panel Messages

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