Set delegate for QTreeWidget header

前提是你 提交于 2019-12-11 07:57:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!