Results 1 to 2 of 2

Thread: QPrinter prints only in GrayScale (option setColorMode enabled)

  1. #1
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default QPrinter prints only in GrayScale (option setColorMode enabled)

    Hi everyone,

    I'm trying to print a QwtPlot, but it is only printed in gray scale. Here is the code:

    Qt Code:
    1. QPrinter printer;
    2.  
    3. printer.setOrientation(QPrinter::Landscape);
    4.  
    5. printer.setOutputFormat(QPrinter::NativeFormat);
    6. printer.setColorMode(QPrinter::Color);
    7.  
    8. QPrintDialog *dialog = new QPrintDialog(&printer, 0);
    9. dialog->setWindowTitle(tr("Print Plot: ") + myPlotName);
    10. if (dialog->exec() != QDialog::Accepted) return;
    11.  
    12. QPainter painter;
    13. painter.begin(&printer);
    14. painter.setPen( Qt::black);
    15. painter.setFont(QFont("Arial", 12));
    16.  
    17. my_plot->print(&painter, QRect(100,100,800,600), filter);
    18. QString dateLabel = "Produced on: " + QDate::currentDate().toString() + " at: " + QTime::currentTime().toString();
    19. painter.drawText(QRect(0,0, 600, 600), dateLabel);
    20. painter.end();
    To copy to clipboard, switch view to plain text mode 

    The curious thing, if I export it as PDF:

    Qt Code:
    1. printer.setOutputFormat(QPrinter::PdfFormat);
    2. printer.setOutputFileName(filename);
    To copy to clipboard, switch view to plain text mode 

    It is correctly exported, in color.

    Any idea please??

    Thanks in advance

  2. #2
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPrinter prints only in GrayScale (option setColorMode enabled)

    I havent found the solution yet. Any ideas please?? It is a bug in the QwtPlot module?

Similar Threads

  1. Replies: 3
    Last Post: 20th April 2010, 16:49
  2. problem with Recieving grayscale
    By navi1084 in forum Qt Programming
    Replies: 1
    Last Post: 27th September 2008, 22:51
  3. How to display 16 bit grayscale pictures?
    By reimer in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 19:55
  4. can you save 8 bpp grayscale bitmaps?
    By eric in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 11:00
  5. QPrinter::PrinterMode and QPrinter::setResolution??
    By SkripT in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2006, 11:59

Tags for this Thread

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.