[Interest] QPixmap and threads

Konstantin Tokarev annulen at yandex.ru
Fri May 5 16:19:36 CEST 2017



05.05.2017, 11:26, "Giuseppe D'Angelo" <giuseppe.dangelo at kdab.com>:
> Il 05/05/2017 09:05, maitai ha scritto:
>>  But still, I have hundreds of other QPixmaps used in threads, with no
>>  problem at all (creating, painting, etc). All is working fine for years,
>>  without any warning or so from Qt.
>
> Well, not having problems doesn't imply that what you were doing was
> correct...
>
>>  Should I change also all these
>>  QPixmaps to QImages (with a conversion cost at the end of the threads)?
>
> Yes. Note that the conversion cost may be extremely small: QPixmap these
> days is simply holding a QImage in the "right format" for display.

Except cases/platforms when QPixmaps are native-backed

> If
> your QImage is already in that format, only a cheap refcount increase is
> needed, not a full format conversion.
>
>>  If QPixmaps are forbidden outside the main GUI thread, why is it not
>>  written in the documentation?
>
> It is implied by the lack of "This class is reentrant" note in QPixmap
> documentation. It's also documented that way in other places, like
>
> http://doc.qt.io/qt-5/thread-basics.html
>
> See also slides 27+
>
>>  https://conf.qtcon.org/system/attachments/104/original/multithreading-with-qt.pdf?1473018682
>
> Cheers,
>
> --
> Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
> KDAB - Qt, C++ and OpenGL Experts
>
> ,
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin



More information about the Interest mailing list