On 24 May 2024, at 20:39, Michael Jackson wrote:
I have a question about how the column widths of a QTableView are calculated?
How can I have the QTableView set the column with “to contents” that includes
the QHeader also? For example I have a QHeaderView with the first “section”
that has text “This is a really really really long header”, but the actual data
that is in the QTableView under that header are short values such as “100” or
“2” or “1.231”. When the QTableView is rendered the the column with is only as
wide as the QTableView. It is like the QHeaderView is not taken into account
when calculating the width of the column.
This is with Qt 6.5.3 and 6.6.3.
--
Mike Jackson
Hi Mike,
you should be able to reimplement
https://doc.qt.io/qt-6/qtableview.html#sizeHintForColumn and
https://doc.qt.io/qt-6/qtableview.html#sizeHintForRow to take the
https://doc.qt.io/qt-6/qheaderview.html#sectionSizeHint into account.
Cheers,
Volker
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest