how do i perform center text in Qtablewidget
-
-
hi guys i wanna ask for help here,
how do i perform center tex in Qtablewidget?
just to make it clear, here is the preview of my table:
i want the text below the header is center, what should i do?
every answer it'll be appriciate it.thank you
@farhanrbn See documentation: https://doc.qt.io/qt-5/qtablewidgetitem.html#setTextAlignment
-
Hi
Its a setting on the item.
QTableWidgetItem* item = new QTableWidgetItem( "text is here" );
item->setTextAlignment( Qt::AlignCenter );
ui->tableWidget->setItem(1,0,item); -
but how do i make every item in my table align to center while all of my item is depends on my database?
@Redho-B-N In that case you should not use QTableWidget. You should use QTableView instead, with a data model,
-
@Redho-B-N In that case you should not use QTableWidget. You should use QTableView instead, with a data model,