ALSO: You need to define a signal that you emit in the thread, like:
//in thread definition:
signals:
void values( double, double, double );
//in thread definition:
signals:
void values( double, double, double );
To copy to clipboard, switch view to plain text mode
Then you can do in the while loop:
emit values( val1, val2, val3 );
emit values( val1, val2, val3 );
To copy to clipboard, switch view to plain text mode
Where do you create the thread? Is it in the Gui?
If so, try this:
connect( workerThread, SIGNAL( values( double, double, double ) ), this, SLOT( displayValues( double, double, double ) ) );
connect( workerThread, SIGNAL( values( double, double, double ) ), this, SLOT( displayValues( double, double, double ) ) );
To copy to clipboard, switch view to plain text mode
If it is not, then I suggest implementing the singleton pattern for your main window. Doing this you'll provide a GPSGui::Get() static method.
You'll be able to do( before actually starting the thread):
connect( workerThread, SIGNAL( values( double, double, double ) ), GPSGui->Get(), SLOT( displayValues( double, double, double ) ) );
connect( workerThread, SIGNAL( values( double, double, double ) ), GPSGui->Get(), SLOT( displayValues( double, double, double ) ) );
To copy to clipboard, switch view to plain text mode
Having said this, I assumed your thread is a QThread... Is it? Because if it isn't, you'll need to approach things differently...
regards
Bookmarks