[Qt-interest] painting widgets in console applications?

Bachrach, Robert L rob.bachrach at tycoelectronics.com
Fri Feb 13 13:49:31 CET 2009


> I implemented a Qt/Qwt-based plotting application to plot 
> particular measurement data. The application provides an 
> export functionality to save the plotting widget into an 
> image file via QPixmap. All nice and shiny so far.
> 
> Now I'd like to run my app from the console and directly 
> export into an image file without showing a user interface. 
> Render()'ing the widget directly onto a QPixmap works, but 
> still requires some form of window manager to be 
> active/accessible (i.e. QApplication(argc, argv, 
> enableGUI=true)).

To my knowledge, you simply cannot create widgets without a server.  If you don't need the plot to look exactly the same as in the GUI, you might consider looking at GNUplot (http://www.gnuplot.info/).  It allows you to create robust plots using a scripting language and display them to a variety of devices, including image files.  I have used this on many occasions to generate plot images in scripts.

Rob



More information about the Qt-interest-old mailing list