title: Get index of checked radio button in group
body: <p>I have several radio buttons in a group, is there a way to get the index of the currently checked item?</p>
  
  <p><a href="https://i.stack.imgur.com/CZLH9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CZLH9.png" alt="enter image description here"></a></p>
  
  <p>Right now I use this code:</p>
  
  <pre><code>int getCheckedRadioButton(QWidget *w)
  {
      int ii = 0;
      foreach (QRadioButton *button, w-&gt;findChildren&lt;QRadioButton*&gt;()) {
          if (button-&gt;isChecked()) {
              return ii;
          }
          ii++;
      }
      return -1;
  }
  </code></pre>
  
  <p>which works well enough, but maybe there is a standard Qt function or way to do it?</p>