title: Is it possible to set minimum space between widgets in QGridLayout?
body: <p>I want to create a resizable window that contains some icons that resize according to window.
  I created a window and placed the icons in a grid layout, it worked as i wanted so far.</p>
  
  <p>But the problem is that when I shrink the window to tiny size, icons are too small and can't recognize at all.
  So I set the minimum size of the icons and it seemed to solve the first problem.</p>
  
  <p>Now, the problem is that icons are overlap when I shrink the window and it looks ugly.</p>
  
  <p>I tried using spacer, widget margin, spacing of layout and minimumRowHeight property.</p>
  
  <p>But Qt seems the window size is higher priority than widget's minimum size or margin or other.</p>
  
  <p>They all shrink and still no space at all between widgets.</p>
  
  <p>I can solve this problem with minimum size of window.
  However, it will take several attempts to determine the best looking minimum size.</p>
  
  <p>So my question is:</p>
  
  <ol>
  <li><p>I wonder if there is a margin(or spacing) between widgets in layout that never shrink.
  If there is, I just place my icons in a generous window size and set a margin that doesn't shrink, so the minimum size of window can be determined it self.</p></li>
  <li><p>If not, what is best way to make what I want? is that minimum size of window?
  If then, how do I determine the best minimum size?</p></li>
  </ol>
  
  <p>Any advice or documentation would be highly appreciated.</p>
  
  <p>Add:</p>
  
  <ol>
  <li>This is what I want. I set the minimum height of window to 380px. </li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/CgpwR.png" alt=""></p>
  
  <ol start="2">
  <li>If I'm not set the minimum height, the icons are overlap as above</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/WctSY.png" alt=""></p>
  
  <ol start="3">
  <li>I changed height several times to determine the height of the image at 1, if the height is not enough, the icons too close as shown</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/T23Us.png" alt=""></p>
  
  <p>Here's some code:</p>
  
  <pre><code>verticalLayout = new QVBoxLayout(widget); // window layout
  
  labelTime = new QLabel(widget);
  verticalLayout-&gt;addWidget(labelTime);
  
  gridLayout1 = new QGridLayout(); // grid layout at top
  gridLayout1-&gt;setSpacing(15);
  labelIcon1 = new QLabel(widget);
  labelIcon1 -&gt;setMinimumSize(QSize(40, 40));
  labelIcon1 -&gt;setPixmap(QPixmap(path));
  gridLayout1-&gt;addWidget(labelIcon1, 0, 0, 1, 1);
  
  ... // create icons and add to gridlayout1
  
  verticalLayout-&gt;addLayout(gridLayout1);
  
  line = new QFrame(widget);  // just line.
  verticalLayout-&gt;addWidget(line); // add to vertical layout, not grid layout.
  
  ... // create grid layout, icons at bottom and add it to vertical layout, same as top
  </code></pre>
  
  <p>Structure looks like this:
  QLabel, QGridLayout, Line, QGridLayout2 are placed in a vertical layout.</p>
  
  <pre><code>-------------vertical layout
  [   text   ]
  -------------grid layout
  [icon][text]
  [icon][text]
  -------------grid layout
  [   line   ]
  -------------grid layout 2
  [icon][text]
  [icon][text]
  [icon][text]
  -------------grid layout 2
  -------------vertical layout
  </code></pre>