Yeah, go ahead and put it up on Phab!

Nate



On 1/18/19 1:56 PM, René J.V. Bertin wrote:
Hi,

Assistance would be appreciated. :-)

I've whipped up something, a bit sneaky but it does more or less what I had in 
mind.

- the QEvent::Polish handler connects to the sectionResized signal
- this sectionResized slot will check if the QTreeView contains a positive number of 
elements, if the new size is positive and if the current resize mode is not already 
"Interactive". If so, it sets the current section to interactive resize and 
sets the new size explictly.
- somehow this per-column change does not have the intended effect (when done 
here, with Qt 5.9 and FW 5.52.0), so a class state variable is toggled too
- at an appropriate moment the entire QHeaderView is set to interactive mode if 
that state variable is true. The first QPaintEvent should come after the 
section widths have been determined and turns out to be just in time to get 
actually resizable sections.

I haven't checked in depth if there are side-effects but this works good enough 
for me (as a first draft). The only thing I'd like to see added is the 
persistence of the column widths I mentioned earlier: save the widths of any 
columns the user resized manually, and use those values when the dialog is 
reopened.

Let me know what you think; should I put this on phab?

R.



Reply via email to