title: QT push button / stop button
body: <p>I have a push button that I'd like to change to a stop button when clicked. Currently the button's text says "auto fire", it runs an endless loop and it's text changes to "stop auto fire" when clicked. My problem is breaking the endless loop by clicking/pressing this button again after the text changes.</p>
  
  <p>Code so far:</p>
  
  <pre><code>void Cpp_Fire::on_auto_fire_clicked()
  {
      while(true)
      {
          ui-&gt;auto_fire-&gt;setText("Stop Auto Fire");
          on_manual_fire_clicked();
      }
  }
  </code></pre>
  
  <p>I tried inserting a different slot into the loop above that runs when after the button is pressed (it runs when the button is released to be precise) but I couldn't get it to work.
  I know this could be done with signals/slots and a separate stop button but I'm unfamiliar with that method and I prefer the method I described.</p>