Thanks for your reply.
In my program, the variables' values are updated in the main.cpp file, therefore, I think I should update their values in the GUI also in the main.cpp file, right?
If it should be as you said, how should I send the variables' values from main.cpp to mainwindow.cpp? Do you mean that I define the variables as global? This will not be a safe solution, right?