Set the header text of a QTreeView header
Asked Answered
B

1

13

I have the same problem as:

What is the method to set the text for a QTreeWidget's header?

with one difference: I'm using a treeView, not tree widget, so the answer there didn't help.

I couldn't find in the documentation any instructions how to it.

So - how can I set the header text of a QTreeView?

Beliabelial answered 3/9, 2012 at 9:33 Comment(0)
B
19

It may be done in your model class that probably inherits QStandardItemModel.

Typically, you would call:

QStandardItemModel::setHorizontalHeaderLabels ( const QStringList & labels )

for text only, or

 QStandardItemModel::setHorizontalHeaderItem ( int column, QStandardItem * item )

if more customization is needed in the header items.

Bobine answered 3/9, 2012 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.