QTableWidget获取一行数据

ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);

connect(ui->tableWidget, SIGNAL(cellClicked(int , int )) , this, SLOT(showData(int, int))) ;
void SetupWdiget::showData(int row, int column)
{
    int col = ui->tableWidget->columnCount() ;
    ui->nameLineEdit->setText(ui->tableWidget->item(row,0)->text());
    ui->rtspLineEdit->setText(ui->tableWidget->item(row,1)->text());
    ui->rtmpLineEdit->setText(ui->tableWidget->item(row,2)->text());
    bool check = ui->tableWidget->item(row,3)->text()==tr("Yes") ? true:false;
    ui->checkBox->setChecked(check);
}

你可能感兴趣的:(tablewidgit,获取一行数据,QT)