title: How to properly use QGridLayout to addWidgets next to each other in Qt5
body: <p>I have a small problem trying to put two layouts next to each other. </p>
  
  <p>The actual result I have so far is the followig:</p>
  
  <p><img src="https://i.imgur.com/Tvdacnu.png" alt="layoutwrong"></p>
  
  <p>But it should look like this one below:</p>
  
  <p><img src="https://i.imgur.com/ZkAdc7j.png" alt="layoutok"></p>
  
  <p>What am I missing? </p>
  
  <p>Below the small snippet of code I am using for this:</p>
  
  <pre><code>MyViz::MyViz(QWidget *parent) : QWidget(parent)
  {
  
  //  Qt Components set up......
  
  QGridLayout* control_layout = new QGridLayout();
  control_layout-&gt;addWidget(thickness_label, 0, 0);
  control_layout-&gt;addWidget(thickness_slider, 0, 1);
  control_layout-&gt;addWidget(cell_size_label, 1, 0);
  control_layout-&gt;addWidget(cell_size_slider, 1, 1);
  
  control_layout-&gt;addWidget(thickness_label_second_renderer, 0, 2);
  control_layout-&gt;addWidget(thickness_slider_second_renderer, 0, 3);
  control_layout-&gt;addWidget(cell_size_second_renderer_label, 1, 2);
  control_layout-&gt;addWidget(cell_size_second_renderer_slider, 1, 3);
  
  
  // construct lay-out and render panels next to each other
  render_panel = new rviz::RenderPanel();
  render_panel2 = new rviz::RenderPanel();
  
  QVBoxLayout* main_layout = new QVBoxLayout;
  main_layout-&gt;addLayout(control_layout);
  main_layout-&gt;addWidget(render_panel);
  main_layout-&gt;addWidget(render_panel2);
  
  // set the top-leve layout for this MyViz widget
  setLayout(main_layout);
  
  // other operation....
  
  }
  </code></pre>