dst2
dst2

Reputation: 495

Qt: How to fix column width for a QTreeWidget?

I need to set the width of a column in my QTreeWidget to a fixed size. setColumnWidth() appears to have no effect, and the code given here results in the compiler error " 'headerView': is not a member of 'QTreeWidget' ".

I am using Qt 4.7.4.

Upvotes: 3

Views: 4934

Answers (1)

Tyler Jandreau
Tyler Jandreau

Reputation: 4335

QHeaderView::resizeSection() may work for you. Try doing the following code:

treeWidget->header()->resizeSection(index, width);

Upvotes: 2

Related Questions