
Originally Posted by
Zlatomir
2) You might want to use
append instead of the second SetPlainText() (or maybe insert, look in the documentation link)
3) If i understand correctly you need a slot or member function in the class that contains the ui, and call that function with the text you need to set/append/insert... and in that function use setText/append...
1) i didn't understand your question, are you trying to code something like:
cin >> var; if(var == 1); ? If so in gui application you can have a button that once it is clicked it performs the operations, and/or use some textEdit to take input.
Thanks for the reply, append was the function I was looking for, just didnt know it's name.
1. I am actually trying to create a situation where the code will stop executing the function (slot) that is running if certain conditions are met. To do this in console I would just return 0. What is the GUI equivalent?
3. Not quite, I have the slot function website but I am also calling my own functions within that function. To make the program easier to maintain and keep track of I have stored some of those functions in separate .cpp files. I am now running into UI issues when calling those functions from another .cpp file and executing them within main. The functions within the secondary .cpp file write to ui and I think this is the issue. Here is something which I am looking to do (and the header files are all linked correctly etc).
mainwindow.cpp
void MainWindow::on_processButton_clicked(){
// do stuff
randomFunction();
}
void MainWindow::on_processButton_clicked(){
// do stuff
randomFunction();
}
To copy to clipboard, switch view to plain text mode
second.cpp
randomFunction(){
// do stuff
ui->randomBox->setPlainText("text here");
}
randomFunction(){
// do stuff
ui->randomBox->setPlainText("text here");
}
To copy to clipboard, switch view to plain text mode
Bookmarks