setItemWidget to QTreeWidget
-
How to use the api
setItemWidgetto set a widget to a specific column of aQTreeWidgetheader?@n34rt
Did you try callingsetItemWidget()onQHeaderView? If that does not work I presume you must use the methods at https://doc.qt.io/qt-6/qheaderview.html#protected-functions or QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate) to draw one.Or, there is an old article Qt Support Weekly #27 – Widgets on a header, and https://stackoverflow.com/questions/27000484/add-custom-widgets-as-qtablewidget-horizontalheader. Several suggestions can be found by Googling
qheaderview add widget. -
I think you can't do that.
Take a look at https://www.qt.io/blog/2012/09/28/qt-support-weekly-27-widgets-on-a-header about writing a custom headerView with widgets.