Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. HorizontalHeaderView textRole not working
Forum Update on Monday, May 27th 2025

HorizontalHeaderView textRole not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
textrole
1 Posts 1 Posters 165 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RYDJ
    wrote on last edited by
    #1

    I have a Table View with custom c++ QAbstractTableModel class as the model.

    The model has custom roles sent back to qml using a QHash.
    The roles are:
    {{Header Data, "HData" }, {First Name, "FName" }, {LastName, "LName" } } ;

    The table fills normally

    Now :

    HorizontalHeaderView {
        id: horizontalHeader
        syncView: tableView
        anchors.left: tableView.left
        textRole: "display" // which is the default
    }
    

    The above results in HeaderData() method to be in voked, but if I change "display" to any other role the method never gets invoked.

    Now I have a workaround to display the header text, but why is this happening I believe this might be a bug.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved