I use the same code for print preview. But in Windows I get a quite different preview from Linux.
See the attached screenshots.
Why?
Printable View
I use the same code for print preview. But in Windows I get a quite different preview from Linux.
See the attached screenshots.
Why?
Can you show us your code? From the screenshots it seems that you don'T have specified the pagesize and therefor it uses the default pagesizes on the platforms, which could differe.
In printPreview there is a call to a method in a class:Code:
void MainWindow::printPreview(){ QPrintPreviewDialog preview(&print,this); preview.exec(); } ... printReport(p,0); }
Code:
... m_document->setPageSize(printer->pageRect().size()); ... m_cursor.insertHtml(site); 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(); p.end();
Hi, I have a different problem with QPrintPreviewDialog on Linux. The initial size of the preview window is too small. How do I set the size of the preview window?
QPrintPreviewDialog is a normal dialog. So just use QWidget::geometry or QWidget::adjustSize().