[Qt-interest] Generating images in a web service

Sean Harmer sean.harmer at maps-technology.com
Fri Jun 10 12:28:49 CEST 2011


On Friday 10 June 2011 09:45:22 Tony Rietwyk wrote:
> Hi Everyone,
> 
> I currently have a web server that uses QCoreApplication to serve pages.  I
> would like to add generating images that include text onto QImage.  This
> means I have to include QtGui, and presumably use QApplication.  Will that
> be a problem on a Linux or Windows server?  Or will it be OK as long as I
> don't create any widgets?
> 
> Does anyone have any experience with this?

You should be able to use:

QApplication::QApplication ( int & argc, char ** argv, bool GUIenabled )

and pass in false to disable the GUI. From the docs:

"On X11, the window system is initialized if GUIenabled is true. If GUIenabled 
is false, the application does not connect to the X server. On Windows and Mac 
OS, currently the window system is always initialized, regardless of the value 
of GUIenabled. This may change in future versions of Qt."

So you should be able to have your app use QImage without a running X server.

Cheers,

Sean




More information about the Qt-interest-old mailing list