Results 1 to 5 of 5

Thread: Printing plot black & white

  1. #1
    Join Date
    Aug 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Printing plot black & white

    Hallo!

    I got some problems printing my plot. The only available print-options are QPrinter::Color and QPrinter::GrayScale, so when i print my plot on black & white printer i see my curves too light to identish.

    I want to print all curves black on white background.

    Should I modify each curve Pen manually?

    I saw a function QwtPlotPrintFilter::color, but i don't think it will help me someway.
    Last edited by maybe78; 8th October 2009 at 08:08. Reason: spelling error

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

    Default Re: Printing plot black & white

    Quote Originally Posted by maybe78 View Post
    I saw a function QwtPlotPrintFilter::color, but i don't think it will help me someway.
    Well, it was made for exactly your usecase.

    Uwe

  3. #3
    Join Date
    Aug 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Printing plot black & white

    Quote Originally Posted by Uwe View Post
    Well, it was made for exactly your usecase.

    Uwe
    But how should i use it? I thought that it simple returns the grayscale color that would be used instead of my color in print.
    I tried different variants, but couldn't get result.

    the last thing i wrote was:

    Qt Code:
    1. filter.color(QColor(Qt::red),QwtPlotPrintFilter::Curve) = Qt::black;
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Printing plot black & white

    Of course you have to subclass QwtPlotFilter and implement the color method.

    Uwe

  5. The following user says thank you to Uwe for this useful post:

    maybe78 (9th October 2009)

  6. #5
    Join Date
    Aug 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Printing plot black & white

    Quote Originally Posted by Uwe View Post
    Of course you have to subclass QwtPlotFilter and implement the color method.

    Uwe
    Entschuldigung, but i still don't quite sure how to use it (

    in header file i included:

    Qt Code:
    1. class MyPrintFilter : public QwtPlotPrintFilter
    2. {
    3. public:
    4. QColor MyPrintFilter::color(const QColor &c, Item item) const
    5. {
    6. if ( !(options() & PrintBackground))
    7. {
    8. switch(item)
    9. {
    10. case MajorGrid:
    11. return Qt::darkGray;
    12. case MinorGrid:
    13. return Qt::gray;
    14. case Curve:
    15. return Qt::black;
    16. default:;
    17. }
    18. }
    19. return c;
    20. }
    21. };
    To copy to clipboard, switch view to plain text mode 

    and then created filter using this type. But nothing still happens(

    UPD: Oh, i got it working. The line was to thin to see the difference at first look.
    Thank you, Uwe!
    Last edited by maybe78; 9th October 2009 at 08:16.

Similar Threads

  1. Replies: 1
    Last Post: 10th February 2009, 06:21
  2. export and printing qwt plot
    By giusepped in forum Qwt
    Replies: 6
    Last Post: 17th December 2008, 07:04
  3. printing with QwtPlot::print
    By user in forum Qwt
    Replies: 1
    Last Post: 7th March 2008, 07:56

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.