Results 1 to 9 of 9

Thread: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas

  1. #1
    Join Date
    Jul 2011
    Location
    Belgium
    Posts
    24
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default 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:

    Qt Code:
    1. QSvgGenerator genereator;
    2. generator.setFileName(blabla)
    3. generator.setSize(size)
    4. .... Initializing generator, BUT then...
    5.  
    6. QPainter painter;
    7. painter.begin(&generator);
    8. QwtPlot plot = blblabla;
    9. plot->drawCanvas(&painter);
    10. painter.end()
    To copy to clipboard, switch view to plain text mode 

    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:alette(), 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?

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas

    In Qwt5 it is QwtPlot:rint().

    Uwe

  3. #3
    Join Date
    Jul 2011
    Location
    Belgium
    Posts
    24
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default 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...

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas

    Quote Originally Posted by Taxi View Post
    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

  5. The following user says thank you to Uwe for this useful post:

    Taxi (14th February 2012)

  6. #5
    Join Date
    Jul 2011
    Location
    Belgium
    Posts
    24
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas

    Quote Originally Posted by Uwe View Post
    Exactly this way - "do some painting" is in your case QwtPlot:rint( 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:rint(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!

  7. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  8. #7
    Join Date
    Jul 2011
    Location
    Belgium
    Posts
    24
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Qwt 5.2.7 SVG generating QwtPlot::drawCanvas

    Jip, noticed it! Thanks! :-)

  9. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  10. #9
    Join Date
    Jul 2011
    Location
    Belgium
    Posts
    24
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default 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. :-)

Similar Threads

  1. Generating a QT Build
    By mvbaffa in forum Installation and Deployment
    Replies: 2
    Last Post: 18th December 2010, 18:53
  2. Generating SVG
    By beekeep in forum Qt Programming
    Replies: 0
    Last Post: 7th January 2010, 18:55
  3. Generating Log files
    By srohit24 in forum Qt Programming
    Replies: 12
    Last Post: 15th July 2009, 08:57
  4. Replies: 6
    Last Post: 14th May 2009, 13:02
  5. Need help for generating for beginner
    By yuvaraj.yadav in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2009, 11:19

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.