Nominate our 2022 Qt Champions!

Overriding QHeaderView resize section behavior

  • I am attempting to create customized cascade behavior when resizing sections in a QTableView. Only the selected section should resize instead of all sections resizing back to their original size. I originally hooked up to the sectionResized event and was able to implement our needed behavior when the section sizes were increased. However, when shrinking the columns, newSize is always 1 less than oldSize once the minimum size of the adjacent section is reached. The causes lag when resizing sections. Setting QHeaderView to cascade fixes the above, but introduces other unwanted behavior. I have been researching trying to find a way to override the QHeaderView mouse events, however, I cannot seem to find a way to determine if the section resize icon was clicked in the table. Is there any way to do this or am I out of luck?

Log in to reply