Hey guys,
I'm triying to print a QwtPlot and I cannot print its curves in color. I looked at the Bode example, and in the example is the same. You just open the example, go to print and then print it in yout printer (in color) or print in a pdf file with a pdf printer. It is always the same, the curves, amplitude and phase are both black.
There is a bug in the example?, there is a bug in the QwtPlot module? Has anyone else noticed that?
I post here the printing code from the Bode example
#if 1
#else
#if QT_VERSION < 0x040000
printer.setOutputToFile(true);
printer.setOutputFileName("/tmp/bode.ps");
#else
printer.setOutputFileName("/tmp/bode.pdf");
#endif
#endif
QString docName
= d_plot
->title
().
text();
if ( !docName.isEmpty() )
{
printer.setDocName (docName);
}
printer.setCreator("Bode example");
printer.
setOrientation(QPrinter::Landscape);
#if QT_VERSION >= 0x040000
if ( dialog.exec() )
{
#else
if (printer.setup())
{
#endif
if ( printer.
colorMode() == QPrinter::GrayScale ) {
filter.setOptions(options);
}
d_plot->print(printer, filter);
}
#if 1
QPrinter printer;
#else
QPrinter printer(QPrinter::HighResolution);
#if QT_VERSION < 0x040000
printer.setOutputToFile(true);
printer.setOutputFileName("/tmp/bode.ps");
printer.setColorMode(QPrinter::Color);
#else
printer.setOutputFileName("/tmp/bode.pdf");
#endif
#endif
QString docName = d_plot->title().text();
if ( !docName.isEmpty() )
{
docName.replace (QRegExp (QString::fromLatin1 ("\n")), tr (" -- "));
printer.setDocName (docName);
}
printer.setCreator("Bode example");
printer.setOrientation(QPrinter::Landscape);
#if QT_VERSION >= 0x040000
QPrintDialog dialog(&printer);
if ( dialog.exec() )
{
#else
if (printer.setup())
{
#endif
QwtPlotPrintFilter filter;
if ( printer.colorMode() == QPrinter::GrayScale )
{
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;
filter.setOptions(options);
}
d_plot->print(printer, filter);
}
To copy to clipboard, switch view to plain text mode
Thanks!
Bookmarks