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. QTableWidget do not hide headers on resize
Forum Updated to NodeBB v4.3 + New Features

QTableWidget do not hide headers on resize

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.2k Views 1 Watching
  • 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
    alexandros
    wrote on last edited by
    #1

    Hello Qt community!
    I have a QTableWidget and I don't want its headers to resize forever.
    I know that I can hide the scrollbar, but this still doesn't solve my problem.
    Let's say that I have 3 headers in my QTableWidget, named "One", "Two" and "Three". I want to be able to resize each of these headers without the text of the others to be hidden. So, basically I need a minimum 'resize rate', which has to be set to the width that the text of each header captures.

    Sorry if I am not fully understandable.
    Here are an example screenshot of what I don't want to happen:
    !http://i.imgur.com/7yHkB.png(http://i.imgur.com/7yHkB.png)!
    As you see, I've resized "Two", but the text of "Three" has been hidden, and I've turned scrollbars off. I want to be able to resize each header (column) till the point of not hiding the text of the other headers.

    Thanks in advance for any help :)

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi, A easy way to go is to set a minimum size for all columns (horizontalHeaderMinimumSectionSize. Then set the horizontalHeaderStretchLastSection. Also set the qtablewidget to a fixed horizontal policy. That should make the last column always fill the empty space if the first two are small, but the minimum width will keep all text visible!
      The minimum size of the last column will stop the resizing of the other columns if they reach there minimum size.
      good luck and keep the spirits up ;-)

      Greetz, Jeroen

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexandros
        wrote on last edited by
        #3

        horizontalHeaderMinimumSectionSize=56
        horizontalHeaderStretchLastSection=checked
        qtablewidget->sizepolicy->horizontal policy = fixed

        same as before...:/

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Leon
          wrote on last edited by
          #4

          No one to answer? Same question here...

          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