table->item( 0, 0 )->setText( "1" ); table->item( 1, 0 )->setText( "1" ); for ( int i = 2; i < table->rowCount(); ++i ) { QTableWidgetItem* item1 = table->item(i - 2,0); QTableWidgetItem* item2 = table->item(i - 1,0); table->item(i,0)->setText( QString( "%1" ).arg( item1->text().toInt() + item2->text().toInt() ) ); }