Reputation: 353
I need a column in my QTreeWidget which's width is always x pixels.
So i want to capture a resize of my QTreeWidget columns, to set the with back to my x on resize by user.
But i can't find any Signal like columnWidthChanged
.
Is there any way to call a function/slot when a columns with is changed? Or is there any other solution?
Upvotes: 1
Views: 1268
Reputation: 9696
Instead of connecting to the sectionResized
signal and reverting resizes the user made, why not prevent users from resizing the column in the first place, via
treeWidget.header().setSectionResizeMode(QHeaderView::Fixed)
or prevent resizing only individual columns via
treeWidget.header().setSectionResizeMode(colIdx, QHeaderView::Fixed)
That's easier to implement and much more "natural" to the user.
Upvotes: 2
Reputation: 353
The Signal is emitted by the header of the QTreeWidget.
It's QTreeWidget.header().sectionResized(int column, int oldsize, int newsize)
Upvotes: 1