Hello everyone,

I'm trying my first implementation of a QThread, and I'm trying to pass some data to the thread. It is to be used as a worker thread to keep the GUI responsive, so multiple threads are not going to be created.

Here is the class definition. I'd like to pass in data to the thread using references to prevent a copy from occurring. The thread will be modifying the original data as well.

Qt Code:
  1. class ProcessThread : public QThread
  2. {
  3. public:
  4. void run();
  5. void setSettings(qpiv_settings &settings_in);
  6.  
  7. private:
  8. qpiv_settings settings;
  9. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void ProcessThread::setSettings(qpiv_settings &settings_in)
  2. {
  3. settings = settings_in;
  4. }
To copy to clipboard, switch view to plain text mode 

And here is the basic call to start the thread:
Qt Code:
  1. ProcessThread *thread = new ProcessThread;
  2. thread->setSettings(settings);
  3. thread->start();
To copy to clipboard, switch view to plain text mode 

I've done some small tests, and it doesn't appear like if I modify the values within the thread that it carries back to the original calling function. Am I missing something fundamental?

Thanks in advance!!