PDA

View Full Version : Could a process running in background mode interact with the GUI??



locke
19th March 2010, 11:12
Hi everyone,

Thanks in advance!!

I'm trying to execute a function in background mode:


QFuture<void> future = QtConcurrent::run(this, &MainWindow::myFunction); //myFunction has no input parameters, and returns void

The problem is that, if myFunction doesn't interact with the GUI, then it works. But if it interacts with some element shown on the main window (like a graph, to replot it) then a running time error is thrown.

Is it a normal behavior? How could I execute a function in background mode that interacts with elements on the GUI?

Thank you!

squidge
19th March 2010, 11:19
It's normal behavior. Use signals/slots to interact with the main thread which will then interact with the elements on the GUI on the other threads behalf.