Results 1 to 2 of 2

Thread: Export QwtPlot to png file with help print

  1. #1
    Join Date
    Feb 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Export QwtPlot to png file with help print

    Hi.

    I try to export QwtPlot to png file. I use this function

    Qt Code:
    1. void XTrendViewer::makeExport( const QString& fileName )
    2. {
    3. QPicture picture;
    4. QwtPlot::print( picture );
    5.  
    6. QPixmap pixmap( 800, 600 );
    7. pixmap.fill();
    8.  
    9. QPainter painter( &pixmap );
    10. painter.drawPicture( 0,0, picture );
    11. painter.end();
    12. pixmap.save( fileName );
    13. }
    To copy to clipboard, switch view to plain text mode 

    But I am getting file with white space without image. How to export/save qwtPlot into png, jpg and etc.

  2. #2
    Join Date
    Feb 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Export QwtPlot to png file with help print

    Problem is solved. I used qwt 5.2.1 in past and there was this problem. Now I am using qwt 6.0 and class QwtPlotRenderer. Print and export work fine.

    But example "body" from new version qwt ( 6.0 ) has not worked when I had tried to export QwtPlot into SVG. In my code I use method QwtPlotRenderer.renderTo and QSvgGenerator for the export.

    In example "body" method QwtPlotRenderer.renderDocument is using for this export.

Similar Threads

  1. Replies: 3
    Last Post: 29th September 2013, 18:51
  2. how to export data to a .CSV file
    By qtprgrmr in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2010, 16:22
  3. Replies: 2
    Last Post: 27th October 2009, 13:40
  4. printing with QwtPlot::print
    By user in forum Qwt
    Replies: 1
    Last Post: 7th March 2008, 07:56
  5. Help:Export QGraphicsView to Image File
    By cometyang in forum Qt Programming
    Replies: 5
    Last Post: 26th December 2007, 23:39

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.