I found a solution and it works good.
...
int pw = printer.pageRect().width();
int ph =printer.pageRect().height();
p.begin(&printer);
p.save();
m_document->adjustSize();
QTransform tra;
tra.scale(11,11);
p.setTransform(tra);
m_document->drawContents(&p,printer.paperRect());
p.restore();
QRect rec
(-10,
0,pw
-10,
0.4*ph
);
p.translate(0,0.65*ph);
solarDiagram->print(&p,rec,filter);
p.end();
QPrinter printer(QPrinter::HighResolution);
...
QPainter p;
int pw = printer.pageRect().width();
int ph =printer.pageRect().height();
p.begin(&printer);
p.save();
m_document->adjustSize();
QTransform tra;
tra.scale(11,11);
p.setTransform(tra);
m_document->drawContents(&p,printer.paperRect());
p.restore();
QRect rec(-10,0,pw-10,0.4*ph);
p.translate(0,0.65*ph);
solarDiagram->print(&p,rec,filter);
p.end();
To copy to clipboard, switch view to plain text mode
This is good for A4 paper. The plot is rendered as a vector graphic and I like it.
But I would scale the painter automatically. The value "11" is taken from a trial-and-correct approach.
Moreover, I noticed that if I translate the painter, Qwtplot does not print the title of the plot anymore. If I do not translate the painter everything is printerd.Why?
Bookmarks