Qt qtableview 多行选中,获取行号

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_24890953/article/details/56831136
QList <int> GetRowId::requestRowId()
{
    QItemSelectionModel *selections =  ui->tableView_showExecuteInfo->selectionModel();
    QModelIndexList selected = selections->selectedIndexes();
    QMap <int, int> rowMap;

    foreach (QModelIndex index, selected)
    {

        rowMap.insert(index.row(), 0);
    }
////    qDebug() << "print : " <<rowMap;
////    qDebug() << "acount : " <<rowMap.count() ;
////    qDebug() <<"i = 0 : "<<rowMap.keys();

   return rowMap.keys();
}

猜你喜欢

转载自blog.csdn.net/qq_24890953/article/details/56831136