PDA

View Full Version : Qwt and Offscreen Rendering (Qt 5)



bigjoeystud
9th June 2016, 22:43
Has anyone tried doing anything with Qwt and the offscreen rendering part of Qt 5?

It seems very close to being able to make a PNG/PDF without an X connection, but isn't quite there. If this could work, Qwt could be used for server side programing from a webpage!

The problem I am seeing are the fonts, legends, scales, etc. are not being rendered.

I tried with one of the example programs and I see the same thing! I've tried with minimal and offscreen, but no difference.

Any ideas?

Thanks,
Joey

Here's a short diff to duplicate the problem on the friedberg example, and then you run it as "bin/friedberg -platform minimal". The resulting friedberg.png will have the right image, without the fonts.



Index: plot.cpp
================================================== =================
--- plot.cpp (revision 2458)
+++ plot.cpp (working copy)
@@ -205,5 +205,5 @@
void Plot::exportPlot()
{
QwtPlotRenderer renderer;
- renderer.exportTo( this, "friedberg.pdf" );
+ renderer.renderDocument( this, "friedberg.png", QSizeF( 300, 200 ), 85 );
}
Index: main.cpp
================================================== =================
--- main.cpp (revision 2458)
+++ main.cpp (working copy)
@@ -40,6 +40,10 @@
d_plot->setMode( typeBox->currentIndex() );
connect( typeBox, SIGNAL( currentIndexChanged( int ) ),
d_plot, SLOT( setMode( int ) ) );
+ if (qApp->platformName () == "minimal") {
+ d_plot->exportPlot ();
+ exit (0);
+ }
}

int main( int argc, char **argv )