c++qtqt4.7

How to implement delegate in QHeaderView


I have created one table by using QTableview and QAbstractTableModel . i have added some vertical header by using QHeaderView . In one of the header cell i want to use delegate ..

I am using the delegate but it does not have any impact ..

Is anywhere i am doing wrong ?


Solution

  • Had this issue myself. The answer from the Qt documentation is simple and annoying:

    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.

    In other words you cannot use delegates with QHeaderView.