View Full Version : Problem with Listener and QPixmap

13th October 2009, 16:41
Hi Guys.

I'm building a softfone using pyQt 4.
I have a listener method called on_incoming_call.
When arrives a call, this method change a button image.
But the buttons desappear and Qt shows the following message:

QPixmap: It is not safe to use pixmaps outside the GUI thread
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread

I read in a post that i'll need use signals...
But how can i do it ?


13th October 2009, 18:05
have your thread emit a (Qt-)signal with the necessary data (i.e. a QImage, or a filename) for the gui thread to update the gui (or button-) status.
(I assume you know how to declare a custom signal and how to connect it to a slot.)

Note that you can not use QPixmap in any thread but the gui (aka main) thread, as a QPixmap is an X11 resource (in X11).

13th October 2009, 19:24

Thank you very much.
You help me a lot. :cool: