Hi to forum member,

I'm really new to Qt C++ programming and need help on constructing a very basic concepts.

So here is my objectives:
I create a Qt GUI application consists of several widgets among them are simple QPushButton and QTextEdit widget. So the idea is, when I press the button I'll start updating the QTextEdit text using setText(). However, I need to delegate this process to separated threads/process/events (what is the best approach?) that will respond (start/stop) on the push button click signal.

Below is my code that I needed help to complete it:

Qt Code:
  1. void MyUI::ViewData(){ //this is a slot that is called upon clicked() signal on the pushButton
  2. QString rawdata = "";
  3.  
  4. if(ui->pushButtonView->text() == "Start") {
  5. ui->pushButtonView->setText("Stop");
  6.  
  7. //how to delegate starting update in this part ... ?
  8.  
  9. } else if (ui->pushButtonView->text() == "Stop") {
  10. ui->pushButtonView->setText("Start");
  11.  
  12. //how to delegate stoping update in this part ... ?
  13.  
  14. ui->dataDisplay->setText("");
  15. }
  16. }
To copy to clipboard, switch view to plain text mode 

Thanks