Solved TreeModel & QTreeView header data not displayed
-
Hi,
I followed the Simple Tree Model example (here) to make a tree model/view but I can't see the header data like title/summary...
I hard coded the header data like this:
QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role) const { return "HeaderData !!!"; }
But nothing appears onto the view !
I just see empty space.Any idea ?
Thanks !
-
I solved the problem, the working code is:
QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) return QVariant(); return "HeaderData !!!"; }
See these topics: