How can I clicked on a Tablewidget to get the row/column informations? If I start my GUI it crash. The line self.tableView_movies.cellClicked(self.func_test) made the Error, what shall I change?
class Ui_MainWindow(object): # Variables movie_results = []
def setupUi(self, MyResultWindow):
MyResultWindow.setObjectName("MainWindow")
MyResultWindow.resize(800, 616)
self.centralwidget = QtWidgets.QWidget(MyResultWindow)
self.centralwidget.setObjectName("centralwidget")
self.tableView_movies = QtWidgets.QTableWidget(self.centralwidget)
self.tableView_movies.setGeometry(QtCore.QRect(10, 10, 331, 581))
self.tableView_movies.setObjectName("tableView_movies")
MyResultWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MyResultWindow)
self.tableView_movies.cellClicked(self.func_test) <----
QtCore.QMetaObject.connectSlotsByName(MyResultWindow)
def func_test(self, row, column):
print("T")
CodePudding user response:
You need to call method connect
on the signal to establish the connection.
self.tableView_movies.cellClicked.connect(self.func_test)