How to get a slot when a row of a QTableWidget is clicked ?
Solved
General and Desktop
-
wrote on 3 Apr 2016, 21:30 last edited by
Hi!
I need a way in which where the user clicks a whole row (not only a cell) I can execute a function.
Thanks in advance. -
Hi,
You should check the QHeaderView::sectionClicked signal.
-
Hi,
You should check the QHeaderView::sectionClicked signal.
-
Lifetime Qt Championwrote on 3 Apr 2016, 23:05 last edited by mrjj 4 Mar 2016, 23:07
@cxam
hi
in mainwin.hclass MainWindow : public QMainWindow {... public slots: void sectionClicked(int); ... define slot hook it up ( in mainwin constructor) connect( ui->tableWidget->verticalHeader(), &QHeaderView::sectionClicked , this, &MainWindow::sectionClicked); - in .cpp void MainWindow::sectionClicked(int index) { qDebug() << "row sel:" << index; }
-
@cxam
hi
in mainwin.hclass MainWindow : public QMainWindow {... public slots: void sectionClicked(int); ... define slot hook it up ( in mainwin constructor) connect( ui->tableWidget->verticalHeader(), &QHeaderView::sectionClicked , this, &MainWindow::sectionClicked); - in .cpp void MainWindow::sectionClicked(int index) { qDebug() << "row sel:" << index; }
1/5