1.获得选中行的QModelIndex
connect(tableview->selectionModel(), QItemSelectionModel::currentRowChanged, this, [=](const QModelIndex ¤t,const QModelIndex &previous){
emit Siganl(current);
}
2.根据QModelIndex获得所在单元格的位置
connect(this, & ::Signal, this, [=](QModelIndex cur){
QRect rect = tableview->visualRect(index);
qDebug()<<rect.x()<<rect.y();
}
)
QTableView如何获得选中单元格的相对位置?
最新推荐文章于 2024-09-02 08:45:51 发布