Hello everyone,

To start off I have 3 questions and they mainly relate to GUI/ Qt coding. This is my 1st GUI program and I am converting my c++ console application
to a GUI after putting it off for over a year.

1. I have setup a process to be run when a PushButton is clicked which contains lots of if statements. I would like to know how to stop the program from executing that action any further once it hits a certain point. For example in my console program I would have something like
Qt Code:
  1. if (1 == 1){
  2. // do stuff
  3. }
  4.  
  5. if(1 == 2){
  6. // do stuff
  7. }
  8.  
  9. if(1 == 3)
  10. {
  11. // do stuff
  12. return 0;
  13. }
To copy to clipboard, switch view to plain text mode 

How would I do the same with the GUI?

2. I am using a Plain Text Edit box to display information output from my program. Currently I am using something like

Qt Code:
  1. ui->textBox->SetPlainText("words here");
To copy to clipboard, switch view to plain text mode 

But then if I wish to write to the same text box later on in my program it overwrites all text in the TextBox. How do I make it just additional information to the text box rather than overwrite everything. Note the program is writing to the box and not me.

3. Lastly I have my program setup over multiple .cpp files and have functions I wish to call from other source files which isnt a problem, that's normal. But I would normally use cout << "text here" << endl; within the functions in another cpp file (another than my main). I am using the same code above to try and put some text to screen but getting an error. I asume it has something to do with ui not being declared within the secondary .cpp file I have stored my functions in. Note the following code is within the function from the secondary cpp file.

Qt Code:
  1. ui->textBox->SetPlainText("words here");
To copy to clipboard, switch view to plain text mode 

Any help on these would be greatly appreciated. I am sure they are basic issues I have overlooked.