Now I am trying this:
m_document->print(&printer);
filter.setOptions(options);
printer.newPage();
solarDiagram->print(printer,filter);
m_document->print(&printer);
QwtPlotPrintFilter filter;
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;
filter.setOptions(options);
printer.newPage();
solarDiagram->print(printer,filter);
To copy to clipboard, switch view to plain text mode
where solarDiagram is the pointer to a QwtPlot.
But as you can imagine, the print contains only the plot and not the textdocument.
Thereis a way to tell QTextDocument to "paint" on printer?
Or, how can I bind two printing on the same QPrinter?
I tried the followind code
m_document->setPageSize(printer.pageRect().size());
printer.setOutputFileName(fileName);
....
p.begin(&printer);
m_document->drawContents(&p,printer.paperRect());
printer.newPage();
solarDiagram->print(&p,printer.paperRect(),filter);
p.end();
QPrinter printer(QPrinter::HighResolution);
m_document->setPageSize(printer.pageRect().size());
printer.setOutputFileName(fileName);
....
QPainter p;
p.begin(&printer);
m_document->drawContents(&p,printer.paperRect());
printer.newPage();
solarDiagram->print(&p,printer.paperRect(),filter);
p.end();
To copy to clipboard, switch view to plain text mode
but the textdocument is too small to be seen in the pdf printout, and the plot is printed in the correct size and with high resolution (pdf).
Why the textdocument is not rendered in the correct size?
Bookmarks