[Qt-interest] drawing to an off-screen buffer with QPainter/QImage without a QApplication?

Paul Miller paul at fxtech.com
Wed Jan 6 16:08:07 CET 2010


On 1/6/2010 8:44 AM, william.crocker at analog.com wrote:
>
>>> The thing to try is to try to derive from QCoreApplication. But I don't think that will work because it doesn't provide any painters. But, you don't need any painters QApplication would provide (since you're writing to file, you need to set the color depth and other device metrics yourself when you cerate the durface (QImage/QPixmap) ). If QCoreApplication won't work, then just do what you said, and make a QApplication but just don't show() any dialogs. I also think this will have the side effect of giving you a command prompt immediately.
>>>
>>
>> Yeah, seems to work with making a QCoreApplication. At least on Windows.
>>
>>
>
> I believe the potential problem with this is that (under X11) creation
> of a QApplication
> requires the existence of (and connection to) an X-Server which may not
> exist if you
> are running your app on some sort of compute server.
>
> Many GUI based apps (like mine) have modes where content can be rendered
> "off-line". One should not need to connect to an X11 server to do this.

Exactly - that's what I'm working on here. I need to do basic drawing to 
off-screen images on render farms. So the question is on Linux, does 
creating a QImage require an X11 pixmap as a backend, or will it 
intelligently fall back to an all-software buffer as it seems to do on 
Windows.




More information about the Qt-interest-old mailing list