Results 1 to 3 of 3

Thread: Problem with Listener and QPixmap

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Qt products
    Platforms
    Unix/X11

    Question Problem with Listener and QPixmap

    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 ?

    Thanks

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem with Listener and QPixmap

    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).

  3. The following user says thank you to caduel for this useful post:

    thiagotrss (13th October 2009)

  4. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Qt products
    Platforms
    Unix/X11

    Smile Re: Problem with Listener and QPixmap

    Caduel,

    Thank you very much.
    You help me a lot.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.