Results 1 to 3 of 3

Thread: Basic multithreading question (2 threads).

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Basic multithreading question (2 threads).

    The problem is that the thumbnail generator thread operates on QPixmaps and you can use these only in the GUI thread (it's because the data resides in X server). Use QImages instead.

  2. The following user says thank you to jacek for this useful post:

    jayke (21st February 2008)

  3. #2
    Join Date
    Feb 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Basic multithreading question (2 threads).

    Thanks a lot for your quick reply. I've searched the Qt docs for what you've said and it seems to be right. QPixmap do rely on the underlying window structure, which can, like all GUI stuff, only be manipulated by the primary thread.

    So I've changed the QPixmap to QImage, performed the scale operation on it, and sent back the rescaled QImage to the primary thread, where I convert it to pixmap and put it on my label.

    Next problem I've encountered was that when selecting image1 then image2 while it's still calculating, the image1 thumbnail shows up, while it's supposed to be the thumb from image 2. This has to do with the thread still running, but I'll manage to work my way around that.

Similar Threads

  1. question about socket and threads?
    By oob2 in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2007, 11:42
  2. Replies: 5
    Last Post: 4th August 2006, 10:12
  3. Basic question on new and delete
    By jcr in forum General Programming
    Replies: 25
    Last Post: 14th February 2006, 15:09
  4. Using QSA: A very basic question
    By yogeshm02 in forum Newbie
    Replies: 3
    Last Post: 26th January 2006, 07:34

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
  •  
Qt is a trademark of The Qt Company.