QTreeView/QHeaderView : resize handle on the left
Hi !
Here is what I am trying to do: I have a QTreeView with two columns. The first one is the important one, the second one the not-so-important one. I'd like to have my first column automatically resized when the treeView is resized and the second one to be resizable by hand.
Code:
items->setModel(itemsModel);
header->setStretchLastSection(false);
The issue is that the zone I have to click on to resize a column is on the right. The QTreeView being on the right edge of the window, clicking on the column separator at the end of the last column becomes quite a challenge, and the movement is not intuitive (you have to move the cursor out of the window to the right to have the left side of the column move to the left). I'd like to be able to resize the last column by clicking on the separator present between the two columns.
Is it possible to move the resize handle on the left side of the column ? Is there a better way to do that ?
Thanks in advance
Re: QTreeView/QHeaderView : resize handle on the left
I dont know if it might work, but you can try this -
Get the status bar and change its layout direction :)
Re: QTreeView/QHeaderView : resize handle on the left
Unfortunately, it just doesn't quite do the trick :)
Even though the "resize zone" is moved on the left, the whole widget has its layout switched to Qt::RightToLeft. It induces very weird behaviors of the widgets.
If anyone else has a better option, I'm more than willing to consider it, but it looks like I'll have to just forget about it :/
Re: QTreeView/QHeaderView : resize handle on the left
You can attach to the sectionResized() signal of QHeaderView and do the proper resizing yourself. You'll have to detach the header from resizing the view of course.