[Interest] Is it possible to use QPixmap from non guy thread in Qt5?

Jason H scorp1us at yahoo.com
Fri Feb 15 15:10:27 CET 2013


I'm not sure you can't use QPixmap, I think it more what you expect to use it for.
Back int he day I wrote a code to capture QML animation frames to disk. PNG is a compressed format. The performance of this was not good. So I made a save thread and passed the Pixmap to the thread via a signal which allowed the other cores to do the compression and save and it went much faster. I think the issue is QPixmaps can only be created in the GUI thread since they are tied to the graphics hardware metrics. (Now that we're using GL in many cases, it may not matter?)

Anyone care to weigh in?




________________________________
 From: Samuel Rødal <samuel.rodal at digia.com>
To: interest at qt-project.org 
Sent: Friday, February 15, 2013 3:05 AM
Subject: Re: [Interest] Is it possible to use QPixmap from non guy thread in Qt5?
 
On 02/14/2013 09:15 AM, Иван Комиссаров wrote:
> In Qt4, i always got warning when trying to use QPixpap from thread other than the gui-thread.
>
> However i don't see that warning in Qt5. Also, documentation only says that i can use painter from non-gui thread on a QImage, but doesn't say that i can't use it on a pixmap:)
>
> Also, my test shows that i's possible to use painter on a pixmap in non-gui thread and there are no warnings in console.
>
> So, whom i should believe - my eyes or a QImage documentation?)

Since QPixmap is implemented on pretty much all platforms as a QImage in 
Qt 5 you probably won't get any errors. I'd stick with using QImage 
directly though in case that should ever change.

--
Samuel

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130215/18dea0ed/attachment.html>


More information about the Interest mailing list