Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem using ShowColumn function of TreeView.
Forum Updated to NodeBB v4.3 + New Features

Problem using ShowColumn function of TreeView.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 345 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.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on last edited by
    #1

    Hi..

    I am customizing my tree view based on Hide and Show Column.
    When I tried to Hide last column of tree view it works.
    But When I try to use ShowColumn function to show the last column the column is added after the very long space from previous last column (after hiding the last column).

    So there is lot of empty space between last column and second last column in my tree view.

    How I can fix that?

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      When you don't want to use this function then you have to resize it by your own (since you maybe know faster than the model how big you columns should be)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • A Ayush Gupta

        Hi..

        I am customizing my tree view based on Hide and Show Column.
        When I tried to Hide last column of tree view it works.
        But When I try to use ShowColumn function to show the last column the column is added after the very long space from previous last column (after hiding the last column).

        So there is lot of empty space between last column and second last column in my tree view.

        How I can fix that?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @Ayush-Gupta
        Presumably after re-showing a column you are responsible for adjusting column widths. Try calling QTreeView::resizeColumnToContents(int column) on each column? You could do this where you show/hide columns, or maybe override QTreeView::columnCountChanged().

        1 Reply Last reply
        2
        • A Offline
          A Offline
          Ayush Gupta
          wrote on last edited by
          #3

          QTreeView::resizeColumnToContents(int column) makes my view very slow. Is there any alternative ?

          JonBJ 1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            When you don't want to use this function then you have to resize it by your own (since you maybe know faster than the model how big you columns should be)

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            1
            • A Ayush Gupta

              QTreeView::resizeColumnToContents(int column) makes my view very slow. Is there any alternative ?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #5

              @Ayush-Gupta said in Problem using ShowColumn function of TreeView.:

              QTreeView::resizeColumnToContents(int column) makes my view very slow. Is there any alternative ?

              Yes, do the column resizing yourself. I said you are responsible for doing so. I only suggested QTreeView::resizeColumnToContents(int column) as a possibility, depending on what you want to achieve.

              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