Results 1 to 2 of 2

Thread: QwtPlot Brush and PDF output

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QwtPlot Brush and PDF output

    I have set the brush as in this code
    Qt Code:
    1. plotEnergy = new QwtPlotCurve();
    2. plotEnergy->attach(this);
    3. plotEnergy->setPen(QPen(Qt::red));
    4. plotEnergy->setBrush(QBrush(Qt::Dense7Pattern));
    To copy to clipboard, switch view to plain text mode 

    But when export the pdf I get the picture attached.
    The export is done as simple as:
    Qt Code:
    1. QString fileName;
    2. fileName = QFileDialog::getSaveFileName(this, tr("Nome file da esportare"), QDir::homePath(),"Acrobat ( *pdf)");
    3.  
    4. if ( !fileName.isEmpty() ) {
    5. QPrinter printer(QPrinter::HighResolution);
    6. printer.setOutputFormat(QPrinter::PdfFormat);
    7. printer.setOutputFileName(fileName);
    8. printer.setCreator("Solar Calc");
    9. printer.setOrientation(QPrinter::Landscape);
    10.  
    11.  
    12.  
    13.  
    14. // if ( printer.colorMode() == QPrinter::GrayScale )
    15.  
    16. int options = QwtPlotPrintFilter::PrintAll;
    17. options &= ~QwtPlotPrintFilter::PrintBackground;
    18. options |= QwtPlotPrintFilter::PrintFrameWithScales;
    19. filter.setOptions(options);
    20.  
    21.  
    22. print(printer,filter);
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot Brush and PDF output

    When you zoom in you will see, that the pattern is in your PDF document. Obviously this is the result when painting such a pattern to a paint device with a high resolution. This is done by Qt and I'm afraid there is nothing Qwt can do - at least I'm not aware of a workaround.

    The pattern should be o.k. when you print to a QPrinter with a similar resolution as on screen, but you also lose the precision for mapping the curve points to the document. As soon as Qwt is able to render to doubles the resolution of the QPrinter will be unimportant for scalable document formats like SVG/PDF.

    Uwe

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
  •  
Qt is a trademark of The Qt Company.