C++ (Qt)QTableWidgetItem *item = ui->tableWidget->item(0, 0);item->setTextAlignment(Qt::AlignJustify); // 1item->setTextAlignment(Qt::AlignHCenter); // 2