[Qt-interest] painting widgets in console applications?

Andreas Pakulat apaku at gmx.de
Thu Feb 12 22:19:48 CET 2009


On 12.02.09 21:51:51, Daniel Franke wrote:
> 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)). This is 
> hardly a constraint if run locally, but if run through ssh, which this is 
> meant to, it is: "myplot: cannot connect to X server" - and x11forwarding is 
> not always an option. Letting 'enableGUI=false', Qt complains "QWidget: Cannot 
> create a QWidget when no GUI is being used".

If you're using a QWidget you always need an X11 server. If you want to
avoid that you need to write the plotting code to output directly into a
QImage.

Andreas

-- 
Don't read everything you believe.



More information about the Qt-interest-old mailing list