Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
Hi!
I've got an issue. I'm working with Qwt version 5.2.7. I'm trying to generate a SVG file from my QwtPlot.
At the moment, I'm doing this, simply said with following code:
Code:
QSvgGenerator genereator;
generator.setFileName(blabla)
generator.setSize(size)
.... Initializing generator, BUT then...
painter.begin(&generator);
plot->drawCanvas(&painter);
painter.end()
This works fine BUT it will only draw the plot it self + the grid bot NO axis... Quiet annoying. If I try to draw the axis apart, by getting the axis from the plot and then QwtScaleDraw::draw(&painter,QApplication::palette( ), my axis will be drawn at top. Then there will be no control...
ANd yes, I know that in Qwt version 6 there is a renderer to pdf, svg, etc but I need to use this version!
Any ideas?
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
In Qwt5 it is QwtPlot::print().
Uwe
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
But you can't print too QPainter...
The way I know QSvgGenerator works is that you use a QPainter referenced to the generator, begin the painting, do some painting and end the painting...
I can not do QwtPlot::Print(QPainter painter). I need a paint device...
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
Quote:
Originally Posted by
Taxi
The way I know QSvgGenerator works is that you use a QPainter referenced to the generator, begin the painting, do some painting and end the painting...
Exactly this way - "do some painting" is in your case QwtPlot::print( QPainter *, ... );
Check the examples.
Uwe
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
Quote:
Originally Posted by
Uwe
Exactly this way - "do some painting" is in your case QwtPlot::print( QPainter *, ... );
Check the examples.
Uwe
I am at the moment the most retardic person on the planet. :-) I've been trying to print to a QPainter, but it gave me pointer errors. Verry strangly was this because when using QwtPlot::print(QPainter*, QRect &), you HAVE to define the QRect... The error that was keep coming up never said anything about this. -.- Got it know, thx Uwe. You made me try it again!
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
But be aware of the fact, that QSvgGenerator is not aware of QPainter clipping. Even after enabling polygon clipping of the curves you might have plot items painting outside of the boundaries the canvas.
Uwe
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
Jip, noticed it! Thanks! :-)
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
One more hint: one of the major improvements of Qwt 6 is its floating point render engine.
As you are dealing with SVG I guess scalability is of interest - then using Qwt 6 should be mandatory !
Uwe
PS: There is no Qwt 5.2.7
Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas
Hmmmm ye. I'm getting the impression that Qwt 6 has many handy new functions. I think I will need to have a word with the my promotor. I'm programming with this version because the software packet I need to work on, is a project for multiple years (for master students). I'm at the second workyear now and from the beginning, there was said to keep on using this function untill, let's say Qwt version 6.2 is out. They always wait for a couple of new versions untill they can be sure the new Qwt will be stable, nuff said. :-)