Results 1 to 4 of 4

Thread: Qwt Printing

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

    Default Qwt Printing

    I copied the code from the bode example in my program.
    No errors, anyway the result of the printing is wrong, because
    1) the axis are not shown (the ticks are shown)
    2) the content of the plot, not the box, is shifted down.

    I put the code for completeness.
    Qt Code:
    1. void OptimumPlot::printOut()
    2. {
    3. QString path = QDir::currentPath()+tr("/radiazione.ps");
    4. QPrinter printer(QPrinter::HighResolution);
    5. printer.setOutputFileName(path);
    6. printer.setCreator("Solar Calc");
    7.  
    8. printer.setOrientation(QPrinter::Portrait);
    9. QPrintDialog dialog(&printer);
    10. if ( dialog.exec() )
    11. {
    12. if ( printer.colorMode() == QPrinter::GrayScale )
    13. {
    14. int options = QwtPlotPrintFilter::PrintAll;
    15. options &= ~QwtPlotPrintFilter::PrintBackground;
    16. options |= QwtPlotPrintFilter::PrintFrameWithScales;
    17. filter.setOptions(options);
    18. }
    19.  
    20. print(printer, filter);
    21.  
    22.  
    23.  
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Qwt Printing

    Nobody has the same problem or my question is too elementary?

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

    Default Re: Qwt Printing

    Some diagnostic.
    I realized that if I delete this code
    Qt Code:
    1. void OptimumPlot::alignScales()
    2. {
    3. // The code below shows how to align the scales to
    4. // the canvas frame, but is also a good example demonstrating
    5. // why the spreaded API needs polishing.
    6.  
    7. canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
    8. canvas()->setLineWidth(1);
    9.  
    10. for ( int i = 0; i < QwtPlot::axisCnt; i++ )
    11. {
    12. QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
    13. if ( scaleWidget )
    14. scaleWidget->setMargin(0);
    15.  
    16. QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
    17. if ( scaleDraw )
    18. scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

    which was suggested by the "bode" example

    all wors (the print is correct) but I could not get the scale aligned.
    Any help?

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

    Default Re: Qwt Printing

    To be more precise, I get such picture:
    Attached Images Attached Images

Similar Threads

  1. QWT embedded
    By damien in forum Qwt
    Replies: 3
    Last Post: 20th February 2011, 19:26
  2. QWT introduction
    By nitriles in forum Qwt
    Replies: 4
    Last Post: 28th September 2007, 10:48
  3. How to upgrade Qwt 5.0.1 to Qwt 5.0.2
    By luffy27 in forum Qwt
    Replies: 1
    Last Post: 15th July 2007, 19:55
  4. Printing problem in windows
    By joseph in forum Qt Programming
    Replies: 6
    Last Post: 12th July 2007, 08:04
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

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.