The Ultimate Qt Community site
Home News Forum Wiki Contest FAQ Links

Go Back   Qt Centre Forum > Qt > Qt Programming > Qwt

Qwt Questions related to Qwt - Qt widgets for technical applications.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 18th March 2008, 16:16
Krish Krish is offline
Intermediate user
 
Join Date: Feb 2008
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 74
Thanks: 31
Thanked 0 Times in 0 Posts
Question Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

Hello! Friends,
I am working with Qt4.3 on WinXp. I have a application with qwtplot to draw curves of my application. Now i want to save/convert the drawn qwtplot into a.jpg or. jpeg or .bitmap or any format and save it to the same directory which i can afterwards use to analyse few things.

Can anyone please suggest me the right path to do the needful.

Thanks in Advance

Reply With Quote
  #2  
Old 18th March 2008, 17:33
Uwe Uwe is offline
Intermediate user
 
Join Date: Feb 2006
Location: Munich, Germany
Qt products used: Qt3, Qt4, Qt/Embedded, Qtopia
Qt platforms used: MacOS, Unix/X11, Windows
Posts: 241
Thanks: 0
Thanked 48 Times in 43 Posts
Default Re: Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

a) Use QwtPlot:rint(QPaintDevice&, ...);
b) Use QPixmap::grabWidget

I always recommend a) because the plot is rendered to the geometry of your target and with SVG or PDF you can have a scalable vector graphics format. F.e. you can zoom in a PDF viewer later ( limited by the fact, that Qwt still uses integers, because of Qt3 compatibility ).
The bode example shows how to do it.

With b) you get a screenshot of your window.

Uwe

Reply With Quote
The following user says thank you to Uwe for this useful post:
Krish (19th March 2008)
  #3  
Old 19th March 2008, 10:30
Krish Krish is offline
Intermediate user
 
Join Date: Feb 2008
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 74
Thanks: 31
Thanked 0 Times in 0 Posts
Lightbulb Re: Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

Hello! Uwe,
Thanks very much for informing me that. I got the required result with step a).
But i also want to save the screenshot of my widget, for which i tried step b) but not working
Here is what i tried: -

QPixmap screen;
screen.grabWidget(this);
screen.save("screenshot","JPG",-1);

Can you please suggest where am i going wrong?

Thanks in advance.

Last edited by Krish; 19th March 2008 at 10:38.
Reply With Quote
  #4  
Old 19th March 2008, 10:46
wysota wysota is offline
Guru
 
Join Date: Jan 2006
Location: Warsaw, Poland
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 11,033
Thanks: 3
Thanked 1,554 Times in 1,507 Posts
Default Re: Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

grabWidget() is a static method.

Reply With Quote
The following user says thank you to wysota for this useful post:
Krish (19th March 2008)
  #5  
Old 12th May 2008, 16:55
thadeu thadeu is offline
Beginner
 
Join Date: Jan 2006
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

Quote:
Originally Posted by Krish View Post
Hello! Uwe,
Thanks very much for informing me that. I got the required result with step a).
But i also want to save the screenshot of my widget, for which i tried step b) but not working
Here is what i tried: -

QPixmap screen;
screen.grabWidget(this);
screen.save("screenshot","JPG",-1);

Can you please suggest where am i going wrong?

Thanks in advance.
I think you need to do this:
QPixmap screen;
screen = QPixmap::grabWidget(this);
screen.save("screenshot","JPG",-1);

Thadeu

Reply With Quote
  #6  
Old 20th May 2008, 12:24
Krish Krish is offline
Intermediate user
 
Join Date: Feb 2008
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 74
Thanks: 31
Thanked 0 Times in 0 Posts
Default Re: Can i save or convert qwtplot into say .jpg or .jpeg, or ....!

Hey! Thanks Thadeu for replying, but i have already solved the problem.

Best Regards.

Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 19:08.

Powered by vBulletin Version 3.7.1 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd., vRewrite 1.5 SEOed URLs completed by Tech Help Forum and Chalo Na.
© 2006–2008 Qt Centre - The Ultimate Qt Community site
The Qt by Trolltech logo is used with express permission of Trolltech ASA. Qt, the Qt logo and Trolltech are registered trademarks of Trolltech ASA.