How to use mouse to resize grid table cells using Qt?
I am using a grid (horizontally and vertically). I like that when the window is resized, the contents of the entire window are filled. but this extension is poorly managed. I often want to resize just one column in a grid layout without resizing the window. for example in Windows Explorer. there are two columns - the left list of directories and their contents from left to right. and I can always press the mouse button between them and drag the resizing of the columns relative to each other.
how can i do this in Qt?
source to share
You need to use QSplitter and not QGridLayout in this particular case (where you only need to display two widgets together). QSplitters are dragged and dropped.
source to share
You are looking for QSplitter
(The procedure is described below in Qt Designer)
- Group your widgets and click
Lay Out Horizontally/Vertically in Splitter
- Place this group in a different layout (for example
QGridLayout
) to automatically expand it. - Congrats! Now your layout is being dragged (from step 1) and expanded (from step 2).
source to share