Single Click Event on Q
Unsolved
General and Desktop
-
I have data in a QTableWidget and I want a function to perform a single click on the first record and display the first item in the QTableWiget in a QLabel. Below is the function code. But the application exit when I run the code, I need assistance please. Thanks in Advance.
## Data source Name is EmployeeList ### self.Staff_Summary_tableWidget.itemclicked.connect(self.single_click) def single_click(self): # print(employees) staff_no_display = self.ui.Staff_No_label.setText(employeeList[0]) employeeList = self.ui.Staff_Summary_tableWidget.currentItem().text()
-
@LT-K101
This is not a full application, just an extract.Presumably if "the application exits" on a click there is an error, and you get an error message somewhere.
Your slot code in itself does nothing other than set two local variables. I do not know whether
employeeList[0]
is valid, nor whether inStaff_Summary_tableWidget.currentItem().text()
there is indeed a current item set forcurrentItem()
to return.