QTableView no selection signal
I want to code a button that is disabled initially bt when someone selects a row in QTableView it is enabled, now coding it to enable is easy, but I also want it to disable automatically when there is no selection on QTableView. How can I do that?
~Thanks in advance
Looks like a job for QAbstractItemView::selectionChanged. Check if the selection is empty or not and enable your button based on that.
Hope it helps
how to do it? i don't have much idea bout subclassing.
No need for subclassing, just add a slot to whatever widget contains both your QPushButton and QTableView
@MainWindow::connect(ui->tableView, SIGNAL(ui->tableView->selectionChanged()), this, SLOT(disableEdit()));@
something like this? I don't know what I'm typing, I'm a bit confused now.
Rather like that:
@connect(ui->tableView, SIGNAL(ui->tableView->selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateEditState(QItemSelection,QItemSelection)));@