[Qt-interest] Few questions about drawing text
Cyril C
cyril.mailing.list at gmail.com
Thu Sep 9 08:49:30 CEST 2010
Le 06/09/2010 08:41, Bo Thorsen a écrit :
> Den 05-09-2010 17:08, Cyril C skrev:
>> Hi all, I've got simple questions related to text drawing in Qt, for
>> which I can't figure out a proper answer.
>>
>> 1a. Is it legal and portable to draw text in a non-GUI thread onto a
>> QImage using QPainter::drawText? From this nice article by Gunnar (
>> http://labs.trolltech.com/blogs/category/painting ) it seems so, but I
>> am still sceptical..
>
> That should work. QImage is one of the few "gui" classes you can use
> in other threads, since it's just an internal blob of memory. Be
> careful when passing it to other threads though.
I think so too but I remember some kind of issue related to a
text-drawing 3rd party library that may not be reentrant or other
potential problems...
>
>> 1b. Of course I would prefer drawing to a GLTexture (and not only text)
>> but my understanding is that even in 4.7, drawing to a QGLContexts in
>> separate threads won't be supported, is that right?
>
> That certainly won't work. GL stuff is a hardware thing, not
> implemented in memory like QImage. AFAIK, you can't even protect all
> GL access with mutexes (which would anyway completely ruin the idea of
> threads).
Well officially , OpenGL *is* reentrant but last time I checked (more
than 1yr ago), *QtOpenGL* is not. If it was, we could use a different
GLContext in each worker thread, as long as they don't access the same
objects (FBOs, textures..) at the same time.
Does someone know about my last question ?
2. Does QGraphicsTextItem or QGraphicsSimpleTextItem take advantage of
QStaticText? I am under the impression that it's not the case, even
though graphics text items are pretty static in most use cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100909/87c86d5d/attachment.html
More information about the Qt-interest-old
mailing list