QTableWidget headers stretching past size of borders
-
Hi. I have a QTableWidget where the headers are stretching past the size of the borders.
This is the code I have used to configure the headers.
ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); ui->tableWidget_Configs->setColumnWidth(0, 1); //Yes, the size of this column is 1px. This was for a test. ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
And this is what the headers look like.
I am unsure why the headers would possibly expand beyond the borders. Please let me know if more information is required.
-
Hi. I have a QTableWidget where the headers are stretching past the size of the borders.
This is the code I have used to configure the headers.
ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); ui->tableWidget_Configs->setColumnWidth(0, 1); //Yes, the size of this column is 1px. This was for a test. ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); ui->tableWidget_Configs->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
And this is what the headers look like.
I am unsure why the headers would possibly expand beyond the borders. Please let me know if more information is required.
@Dummie1138 said in QTableWidget headers stretching past size of borders:
ui->tableWidget_Configs->setColumnWidth(0, 1);
I would guess this does not work because of https://doc.qt.io/qt-6/qheaderview.html#minimumSectionSize-prop
-
@Dummie1138 said in QTableWidget headers stretching past size of borders:
ui->tableWidget_Configs->setColumnWidth(0, 1);
I would guess this does not work because of https://doc.qt.io/qt-6/qheaderview.html#minimumSectionSize-prop
@Christian-Ehrlicher This did also fix the issue, thanks.