Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. void resizeColumnsToContents( QTreeWidget &treeWidget_ )
  2. {
  3. int cCols = treeWidget_.columnCount();
  4. int cItems = treeWidget_.topLevelItemCount();
  5. int w;
  6. int col;
  7. int i;
  8. for( col = 0; col < cCols; col++ ) {
  9. w = treeWidget_.header()->sectionSizeHint( col );
  10. for( i = 0; i < cItems; i++ )
  11. w = qMax( w, treeWidget_.topLevelItem( i )->text( col ).size()*7 + (col == 0 ? treeWidget_.indentation() : 0) );
  12. treeWidget_.header()->resizeSection( col, w );
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement