View Full Version : Qwt Printing

10th December 2008, 08:04
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.

void OptimumPlot::printOut()
QString path = QDir::currentPath()+tr("/radiazione.ps");
QPrinter printer(QPrinter::HighResolution);
printer.setCreator("Solar Calc");

QPrintDialog dialog(&printer);
if ( dialog.exec() )
QwtPlotPrintFilter filter;
if ( printer.colorMode() == QPrinter::GrayScale )
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;

print(printer, filter);


11th December 2008, 17:08
Nobody has the same problem or my question is too elementary?

12th December 2008, 08:20
Some diagnostic.
I realized that if I delete this code

void OptimumPlot::alignScales()
// The code below shows how to align the scales to
// the canvas frame, but is also a good example demonstrating
// why the spreaded API needs polishing.

canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );

for ( int i = 0; i < QwtPlot::axisCnt; i++ )
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
if ( scaleWidget )

QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
if ( scaleDraw )
scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);

which was suggested by the "bode" example

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

12th December 2008, 08:25
To be more precise, I get such picture: