Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

headerData



  • viewerTreeModel::headerData(int section, Qt::Orientation orientation,
    int role

    In in above tree model I have 13 columns but it leading headerData is not called for all columns

    in my case the headerData is skipped fro column 9 and 12 , is there any way I can guide header data to be called fro headerData for all columns



  • Qt Enthusiast about a minute ago
    viewerTreeModel::headerData(int section, Qt::Orientation orientation,
    int role

    In in above tree model I have 13 columns but it leading headerData is not called for all columns

    in my case the headerData is skipped fro column 9 and 12 , is there any way I can guide header data to be called fro headerData for all columns
    I have called hide columns in between



  • @Qt-Enthusiast
    Hi. Just before answering your question, a word for you about your posts.

    A couple of times I have noticed you post like this, where you make post, and then when you want to alter its content you make a brand new second post. Are you aware that after you have made a post there is a vertical ... button at the lower-right of your posts (to the right of the reply quote ^0v)? You can left-click on that and pick Edit. That allows you to edit your own posts to change it. You do not need to make a new post or delete the original one. That's much clearer for you and anyone else trying to answer! :)

    Now to your question. It is your code which calls QAbstractItemModel::setHeaderData() for each column, so it's up to you what columns you do or do not call it on, so I'm not sure just what you are asking about. The fact that you have hidden some columns is not relevant, and the column number (section) that you pass is still range 0 to 12.


  • Moderators

    @Qt-Enthusiast said in headerData:

    in my case the headerData is skipped fro column 9 and 12 , is there any way I can guide header data to be called fro headerData for all columns
    I have called hide columns in between

    No, because there's no fathomable reason to query the model for the header data if there's no need to display anything.


Log in to reply