hi all i want to update ui from a non member function. Any help other than passing 'this' pointer as my non member is a callback from library.
Below is my code :
mainwindow.cpp
static void callback(QString result)
{
ui->textBrowser->append(result);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
int a=1,b=2;
QLibrary myLib("myaddlib");
myLib.load();
add = (myadd)myLib.resolve("add_function");
add(callback, a, b);
}
So all I need is I should be able to append data to UI from my non member callback. Please help me.
EDIT: i am not permitted to modify my callback
EDIT based on comment: callback
will be called in a different thread, so calling a widget method from there gives error 'cannot send events to objects owned by a different thread'