QT tableWigdet第一行第一列的问题

时间:2023-02-08 15:04:57
QStringList list;
    list<<"Channel";
    for(int i =0;i < GlobalObject::mimoModel->tx;i++)
    {
        list<<QString::number(i+1);
       // ui->tx_table->setItem(i+1,2,new QTableWidgetItem(i-1));
    }
   // ui->tx_table->setItem(0,0,new QTableWidgetItem("Channel"));
    ui->tx_table->setHorizontalHeaderLabels(list);
    QHeaderView* headerView = ui->tx_table->verticalHeader();//通过垂直方向的标题,消除第一行第一列的空格问题
    headerView->setHidden(true); //行名隐藏
    ui->tx_table->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->tx_table->setSelectionMode(QAbstractItemView::SingleSelection);
    ui->tx_table->setEditTriggers(QAbstractItemView::NoEditTriggers);