Qt Centre Forum >
Qt >
Newbie > Set the QTableWidget's columns width to size of content when double clicking header
View Full Version : Set the QTableWidget's columns width to size of content when double clicking header
TheBigOnion
21st August 2015, 15:17
I have a QTTableWidget that has 5 columns. On each of the columns except the first one, if I double click the header divider between two columns, the column to the left re-sizes to fit the content of the column rows. The problem I'm having is that the if I do this on the first column, it resizes but a bit smaller than the largest text value.
Can someone help me figure out how to fix this?
prasad_N
21st August 2015, 20:36
you can use resizeColumnToContents(). may be you can put this at the end of the slot where you are re-sizing left column.
at the end of that function or after you re-size column check if it column 0 then resizeColumnToContents();
doubleClickHandler()
{
//all your resize column code......
if(column == 0)
{
treewidget->resizeColumnToContents();
}
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.