Question: I have two classes, A and B. ClassA calls a method in classB which iterates through a large loop. ClassA also prints to a Qt message box. What I would like is to be able to print the % complete to the message box from classA. Is there any way to do that in C++?

```
ClassA calls ClassB.method();

ClassA <-- 10% -- ClassB.method();

ClassA -- 10% --> MessageBox

```

Answer: 
Since you are using Qt, emit a signal in `B` when progress changes. Connect that signal to a slot in `A` that updates the progress display. That's all you need.
//Above your loop

int IterationsToDo = #;
int IterationsDone = 0;

double Progress = 0;

//At the end of your loop

{

```
 //Loop logic here

 IterationsDone++;
 Progress = IterationsDone / IterationsToDo;
 MessageFunctionHere(std::to_string(Progress));

```

}