问题
I need to set delegate for QTreeWidget
header or make it working with HTML tags using other ways.
I set a delegate for QTreeWidget
items using
ui->tree->setItemDelegate(delegate);
and it works.
But setting a delegate to the header does not work :
ui->tree->header()->setItemDelegate(delegate);
回答1:
It won't work and it's documented here http://qt-project.org/doc/qt-4.8/qheaderview.html#appearance
Note: Each header renders the data for each section itself, and does not rely on a delegate. As a result, calling a header's setItemDelegate() function will have no effect.
来源:https://stackoverflow.com/questions/25478065/set-delegate-for-qtreewidget-header