how to get selected rows in QTableView

后端 未结 3 697
小鲜肉
小鲜肉 2020-12-07 20:18

After watching many threads about getting selected rows numbers, I am really confused.

How do you get ROW numbers in QTableView using QStandardIte

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 20:53

    The method selectionModel() return a QItemSelectionModel.

    You can use QItemSelectionModel class to check/change/other selection(s)

    Example:

    QItemSelectionModel *select = table->selectionModel();
    
    select->hasSelection() //check if has selection
    select->selectedRows() // return selected row(s)
    select->selectedColumns() // return selected column(s)
    ...
    

提交回复
热议问题