Results 1 to 3 of 3

Thread: Create a QImage from a QwtPlot

  1. #1
    Join Date
    Mar 2010
    Location
    Auckland, NZ
    Posts
    121
    Thanks
    9
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Create a QImage from a QwtPlot

    Hi,
    My program has the capability to create a movie from two different sources, one is vtkWindowToImageFilter, the other is QwtPlot. To achieve commonality between these two sources, I want to create a QImage from the QwtPlot. I'm not saying this is the best approach, but I have something that almost works, and it although it may be inefficient I do not have any concerns about speed.

    What I have so far is this:

    // Create an image
    QImage image( qp->canvas()->size(), QImage::Format_RGB32 );
    image.fill( QColor( Qt::white ).rgb() ); // guess you don't need this line
    QPainter p( &image );
    qp->drawCanvas( &p );
    p.drawImage( 0, 0, image );

    This works, but the image is just of the QwtPlot canvas. I want to find a way to make an image that includes the axes etc. Can someone tell me how to do this? BTW I am using Qwt 5.2.1.

    Thanks
    Gib

  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: Create a QImage from a QwtPlot

    See QwtPlotRenderer ( in earlier versions the functionality was available by QwtPlot::print() ).

    Uwe

  3. #3
    Join Date
    Mar 2010
    Location
    Auckland, NZ
    Posts
    121
    Thanks
    9
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Create a QImage from a QwtPlot

    Thanks Uwe. I realized soon after posting my question that I could use QwtPlot:rint() (although it does not appear in the class documentation). I'm using Qwt-5.2.1. It's working fine )

    Gib

Similar Threads

  1. How to create my own QPixmap Or QImage
    By sagirahmed in forum Newbie
    Replies: 20
    Last Post: 12th March 2019, 15:23
  2. Unable to create qwtPlot object
    By jtso8 in forum Qwt
    Replies: 7
    Last Post: 23rd January 2012, 07:43
  3. how to create a curve in qwtplot?
    By ethanfeng in forum Qwt
    Replies: 1
    Last Post: 27th March 2011, 10:05
  4. Replies: 1
    Last Post: 1st February 2010, 16:13
  5. Replies: 13
    Last Post: 18th December 2009, 10:43

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.