title: How can i end while loop after the little red cross clicked in Qt
body: <p>I have a window with many buttons and labels. The problem is when I close these windows (via the little red cross) the program still working in Task Manager (i think because of the while loop that i have in my code).
  in the following sample code:</p>
  
  <pre><code>void MainWindow::on_pushButton_2_clicked()
  {
  
  
   while (true)
   {
     //do something.........
   }
  } 
  </code></pre>
  
  <p>so how can i sense the little red cross and finished the while loop .</p>