QPixmap- It is not safe to use QPixmap outside the gui Thread
-
in main function my dialog is displayed
and i have created a new pthread as followspthread_t t1;
pthread_create(&t1,NULL,&message,NULL);void * message(void *)
{
// data for receiving the buffer on udp
//after receiving
dialog d; // my gui
d.display(buffer); // sending the received buffer to the gui function for displaying the values on the labels}
when i run this code am getting the following error
QPixmap- It is not safe to use QPixmap outside the gui Thread
i have not used QPixmap then why this error
am able to print the received data at the console but not able to set the text on the gui labelscan any one suggest why
}
`
-
Hi,
You are using GUI elements outside the GUI thread and that's not allowed. You'll have to send your buffer to your main thread and from there show your dialog.
Also, please enclose your code in coding tags (first icon to the right) so it's more readable :)
-
Signals and slots can safely transfer data across threads