问题
I use grid layout (horizontal and vertical too). I like the fact that when resizing the window fills the entire window contents. but this extension is poorly managed. I often want to change the size of only one column in grid layout without changing the size of the window. such as in Windows Explorer. there are two columns - the left list of directories and their contents to the left to the right. and i can always press mouse button therebetween and pulling change the mutual sizes of columns in relation to each other.
how can I do this in Qt?

回答1:
You need to use a QSplitter rather than a QGridLayout in this specific case (where you just want 2 widgets shown together). QSplitters are draggable.
回答2:
You are looking for QSplitter
(The following is the procedure in the Qt Designer)
- Group your widgets, and click
Lay Out Horizontally/Vertically in Splitter

- Put this group into another layout (
QGridLayout
, for example) to automatically expand it. - Congrats! Your Layout is now draggable(from step1) and expandable(from step2).
来源:https://stackoverflow.com/questions/26671001/how-to-using-mouse-to-change-size-of-grid-layout-cells-using-qt