Results 1 to 2 of 2

Thread: QwtPlotRenderer, Export with transparent background

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default QwtPlotRenderer, Export with transparent background

    Hi,

    i'm using QwtPlotRenderer to export my plot to a PNG.

    Qt Code:
    1. qwtRender.setDiscardFlag( QwtPlotRenderer::DiscardBackground, false );
    2. qwtRender.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground, false );
    3. plot->setCanvasBackground(Qt::transparent);
    To copy to clipboard, switch view to plain text mode 

    later

    Qt Code:
    1. qwtRender.renderDocument( plot, file, _currentSettings.format.extention, sizePixelMM, _currentSettings.size.dpi );
    To copy to clipboard, switch view to plain text mode 

    But what i get is my plot with a background of my parent widget.

    How can i export a PNG with transparent background?

    Thx

  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: QwtPlotRenderer, Export with transparent background

    You have to render to a QPixmap/QImage. Here you can initialize its background first and then render the plot without background.

    Uwe

Similar Threads

  1. Replies: 2
    Last Post: 27th April 2015, 12:36
  2. Replies: 4
    Last Post: 27th November 2013, 16:15
  3. transparent background
    By fruzzo in forum Qt Programming
    Replies: 13
    Last Post: 18th March 2008, 15:42
  4. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 03:10
  5. Why the background is not transparent?
    By SkripT in forum Qt Programming
    Replies: 4
    Last Post: 9th May 2006, 02:17

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.