void MainWindow::addRow( int fileId, const QString &fileName, int progress ) { int rowId = ui->files->rowCount(); ui->files->insertRow( rowId ); QTableWidgetItem *id = new QTableWidgetItem( QString::number(fileId) ); QTableWidgetItem *fn = new QTableWidgetItem( fileName ); QWidget *wt = new QWidget(); QSpacerItem *s1 = new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding ); QSpacerItem *s2 = new QSpacerItem(1, 7, QSizePolicy::Fixed, QSizePolicy::Expanding ); QVBoxLayout *lt = new QVBoxLayout( wt ); QProgressBar *pb = new QProgressBar( wt ); pb->setObjectName( "PROGRESS_BAR" ); pb->setParent( this ); pb->setValue( progress ); pb->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); lt->addSpacerItem( s1 ); lt->addWidget( pb ); lt->addSpacerItem( s2 ); lt->setMargin( 0 ); wt->setLayout( lt ); ui->files->setItem( rowId, 0, id ); ui->files->setItem( rowId, 1, fn ); ui->files->setCellWidget( rowId, 2, wt ); }