Results 1 to 3 of 3

Thread: Saving Plots as an image file (png, bmp etc.)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Thanked 1 Time in 1 Post

    Default Saving Plots as an image file (png, bmp etc.)

    Hi,

    I have a problem while saving a Qwt plot as an png image.
    I use QPixmap::grabWidget method but only some part of the plot
    is written to png file (only label texts and title), and the plot itself is not written to png file...
    I added snapshots of original plot and saved plot. Any idea to fix the problem?


    Qt Code:
    1. int main(int argc, char **argv)
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. Plot plot;
    6. #if QT_VERSION < 0x040000
    7. a.setMainWidget(&plot);
    8. #endif
    9. plot.resize(600,400);
    10. plot.show();
    11.  
    12. QPixmap p = QPixmap::grabWidget(&plot, 0, 0, plot.width(), plot.height());
    13. p.save("C:\\plot.png","png");
    14.  
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

Similar Threads

  1. Saving pure plot data to image file
    By Debilski in forum Qwt
    Replies: 4
    Last Post: 7th April 2009, 17:02
  2. Saving QGraphicsScene with OpenGL to image
    By elbaschid in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2009, 20:32
  3. Saving QLabel content in a file
    By Caius Aérobus in forum Newbie
    Replies: 1
    Last Post: 29th October 2008, 17:03
  4. Can't Write Image as Jpeg file
    By noufalk in forum Qt Programming
    Replies: 4
    Last Post: 25th July 2007, 14:53
  5. Saving already opened image ...
    By Godlike in forum Newbie
    Replies: 14
    Last Post: 28th March 2006, 21:17

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.