Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved TreeView Hide Column hides the expand / collapse icon and prints plain Table

    General and Desktop
    treeview expand icon symbol column
    2
    3
    1703
    Loading More Posts
    • 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.
    • O
      Opa114 last edited by

      Hi there,

      i have a TreeView which i populate with some data. In the first column i have stored some data i need the whole time, so it makes sense to fill the data there. Because the data should not be visible to the user i hide the column via ui->treeView->setColumnHidden(0, TRUE); which works, but there is a big problem: this command hides the expand / collapse arrow symbol and the Tree Structure, too. I now got a plain table list, which is very bad.

      Is there any way to hide the column without changing the Tree-Structure and the icon?

      I solved it temporarly by storing the data into the last column of my TreeView and hide this column, which works as expected, but maybe there is an easier solution for this?

      1 Reply Last reply Reply Quote 0
      • VRonin
        VRonin last edited by

        Unfortunately no. QTreeView assumes only the first column has children and base everything off that one

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply Reply Quote 1
        • O
          Opa114 last edited by

          Good to know, so my solution to store this in the last column and hide this one is the best solution for me.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post