title: Set grid spacing using Qt
body: <p>I have created a Gird with <code>QPushButton</code>. I would like to set each button spacing to 0. As you can see I set it, but there is still little padding around the button, and I would like to eliminate it.</p>
  <pre><code>QVector&lt;QVector&lt;QPushButton*&gt;&gt; buttons(10);
  
  void MainWindow::createGrid() {
      QFrame *frame = new QFrame(this);
      QGridLayout *layout = new QGridLayout(frame);
  
      layout-&gt;setMargin(0);
      layout-&gt;setSpacing(0);
  
      for(int i = 0; i &lt; 10; ++i){
          buttons[i].resize(10);
  
          for(int j = 0; j &lt; 10; ++j){
              QPushButton *button = new QPushButton(&quot;0&quot;);
              button-&gt;setMinimumSize(50,50);
              button-&gt;setMaximumSize(50,50);
  
              layout-&gt;addWidget(button,i,j);
  
              buttons[i][j] = button;
          }
      }
  
      setCentralWidget(frame);  
  
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/5YSdL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5YSdL.png" alt="enter image description here" /></a></p>