QTableWidget do not hide headers on resize



  • 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 :)



  • 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 ;-)



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

    same as before...:/



  • No one to answer? Same question here...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.