Removing index numbers in QTablewidget
Asked Answered
A

2

22

How can I remove the column with index numbers in QTableWidget ?

Annalisaannalise answered 31/5, 2010 at 10:39 Comment(0)
A
43

Not quite obvious, there are two views the vertical and the horizontal header, they are defined in QTableView, as any widget you can hide them so its

myTableWidget->verticalHeader()->setVisible(false);
Antoniaantonie answered 31/5, 2010 at 10:47 Comment(2)
My horizontal header is sometimes 4 and some times 5. Here i am getting some space if it is 4. How to set with out getting blank spaceAnnalisaannalise
I don't quite understand the questions but you can set the size of a section through the interface in QHeaderView::resizeSection(int section, int size), see docs for QHeaderViewAntoniaantonie
M
5
PyQt6
self.tableWidget.verticalHeader().setVisible(False)
self.tableWidget.horizontalHeader().setVisible(False)
Moya answered 8/2, 2022 at 13:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.