title: How to create a group of UI elements that you are able to iterate through
body: <p>I have an application I am making as a project for a class, which contains the game hangman and others.<br> 
  I have a Line Edit input field for the user to guess a letter. This input is restricted to 1 letter. <br>
   I want to have a for loop that checks if the users input matches any letters from the games target word, and if it does it places that letter on the screen. <br>
  I have a bunch of labels that I plan on putting a single letter in, each arranged to correspond with the letters placement in the correct word string.<br>
  <b>How do I put a qt ui elements into a data structure so that I can access them in a for loop?</b> <br>
  Here is some code I tried after looking online, to give you an idea of what I'm trying to do.</p>
  
  <pre><code>int Hangman::check_input(QString input){
  
      QList&lt;QObject *&gt; visible_word = {ui-&gt;label_0, ui-&gt;label_1,ui-&gt;label_2, ui-&gt;label_3,ui-&gt;label_4};
      int i;
      for (i = 0; i &lt; current_word.length(); i++){
          if (input == current_word[i]){
              ui-&gt;visible_word[i]-&gt;text() == current_word[i];
          }
      }
  }
  </code></pre>