Fix Qt deprecation warnings. QPrinter::paperRect() and QPrinter::pageRect() are obsolete.
This commit is contained in:
committed by
wwmayer
parent
907adc95b3
commit
2bfccf8146
@@ -445,7 +445,11 @@ bool GraphvizView::onHasMsg(const char* pMsg) const
|
||||
void GraphvizView::print(QPrinter* printer)
|
||||
{
|
||||
QPainter p(printer);
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect rect = printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect rect = printer->pageRect();
|
||||
#endif
|
||||
view->scene()->render(&p, rect);
|
||||
//QByteArray buffer = exportGraph(QString::fromLatin1("svg"));
|
||||
//QSvgRenderer svg(buffer);
|
||||
|
||||
@@ -536,7 +536,11 @@ void View3DInventor::print(QPrinter* printer)
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect rect = printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect rect = printer->pageRect();
|
||||
#endif
|
||||
QImage img;
|
||||
_viewer->imageFromFramebuffer(rect.width(), rect.height(), 8, QColor(255,255,255), img);
|
||||
p.drawImage(0,0,img);
|
||||
|
||||
@@ -612,12 +612,20 @@ void DrawingView::print(QPrinter* printer)
|
||||
qApp->restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect rect = printer->pageLayout().fullRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect rect = printer->paperRect();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
// On Windows the preview looks broken when using paperRect as render area.
|
||||
// Although the picture is scaled when using pageRect, it looks just fine.
|
||||
if (paintType == QPaintEngine::Picture)
|
||||
rect = printer->pageRect();
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect rect = printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect rect = printer->pageRect();
|
||||
#endif
|
||||
#endif
|
||||
this->m_view->scene()->render(&p, rect);
|
||||
p.end();
|
||||
|
||||
@@ -757,12 +757,20 @@ void MDIViewPage::print(QPrinter* printer)
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect targetRect = printer->pageLayout().fullRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect targetRect = printer->paperRect();
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
// On Windows the preview looks broken when using paperRect as render area.
|
||||
// Although the picture is scaled when using pageRect, it looks just fine.
|
||||
if (paintType == QPaintEngine::Picture)
|
||||
targetRect = printer->pageRect();
|
||||
#if QT_VERSION >= 0x050300
|
||||
QRect targetRect = printer->pageLayout().paintRectPixels(printer->resolution());
|
||||
#else
|
||||
QRect targetRect = printer->pageRect();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//bool block =
|
||||
|
||||
Reference in New Issue
Block a user