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?

enter image description here

+3


source to share


2 answers


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.



+4


source


You are looking for QSplitter

(The procedure is described below in Qt Designer)

  • Group your widgets and click Lay Out Horizontally/Vertically in Splitter



enter image description here

  1. Place this group in a different layout (for example QGridLayout

    ) to automatically expand it.
  2. Congrats! Now your layout is being dragged (from step 1) and expanded (from step 2).
+1


source







All Articles