Worked it out finally, it was really simple and you don't need to pass pointers at all like in your example. Instead you have to declare the functions within the mainwindow.h as private slots of MainWindow class.
mainwindow.h
private slots:
void on_processButton_clicked();
void RandomFunction();
private slots:
void on_processButton_clicked();
void RandomFunction();
To copy to clipboard, switch view to plain text mode
mainwindow.cpp looks like
void MainWindow::on_processButton_clicked(){
// do stuff
MainWindow::randomFunction();
}
void MainWindow::on_processButton_clicked(){
// do stuff
MainWindow::randomFunction();
}
To copy to clipboard, switch view to plain text mode
secondary.cpp
#includes "mainwindow.h"
#includes "ui_mainwindow.h"
void MainWindow::RandomFunction(){
// do stuff
ui->randomBox->setPlainText("text here");
}
#includes "mainwindow.h"
#includes "ui_mainwindow.h"
void MainWindow::RandomFunction(){
// do stuff
ui->randomBox->setPlainText("text here");
}
To copy to clipboard, switch view to plain text mode
really simple with some example code there if anyone else is having the same issue when 1st coming over from console coding.
Bookmarks