int width = ui->tableResident->width(); ui->tableResident->setColumnWidth(0, width-(60+80+80+100)); ui->tableResident->setColumnWidth(1, 60); ui->tableResident->setColumnWidth(2, 80); ui->tableResident->setColumnWidth(3, 80); ui->tableResident->setColumnWidth(4, 100); ui->tableResident->horizontalHeader()->setStretchLastSection(true); ui->tableResident->horizontalHeader()->resizeSections(QHeaderView::Fixed);