title: Qt C++: Connecting value changing in two spinboxes
body: <p>I have a form with two spinboxes which must be connected because of aspect ratios for width and height. When I click on first spinbox and increase/decrease value, the other, second spinbox should change its value to be in ratio with the first spinbox. I've already done the ratio connections, but there is problem, because I connect both spinboxes on SLOT valueChanged(int) and this method block whole program because endless loop. This means that when I increase value to first spinbox, value change first for this one and then for second one which is again calling the first one.</p>
  
  <p>I would like to solve this problem, so when I click on one of spinboxes, to change both values in right way without endless loop.</p>
  
  <p>So there is the code:</p>
  
  <pre><code>void MainWindow::on_sbHeight_valueChanged(int arg1)
  {
      if (arg1 != 0) {
      if (ui-&gt;radioRatio1-&gt;isChecked()) {
          ui-&gt;sbWidth-&gt;setValue((arg1/8)*2);
      } else if (ui-&gt;radioRatio2-&gt;isChecked()) {
          ui-&gt;sbWidth-&gt;setValue((arg1/14)*3);
      }
      } else {
      ui-&gt;sbWidth-&gt;setValue(arg1);
      }
  }
  
  void MainWindow::on_sbWidth_valueChanged(int arg1)
  {
      if (arg1 != 0) {
      if (ui-&gt;radioRatio1-&gt;isChecked()) {
          ui-&gt;sbHeight-&gt;setValue((arg1/2)*8);
      } else if (ui-&gt;radioRatio2-&gt;isChecked()) {
          ui-&gt;sbHeight-&gt;setValue((arg1/3)*14);
      }
      } else {
      ui-&gt;sbHeight-&gt;setValue(arg1);
      }
  }
  </code></pre>