+ fixes #0002297: 'Export to PDF...' from drawing view does not show an error if existing file can not be overwritten
This commit is contained in:
parent
9abedaf0d2
commit
efd3a494d7
|
@ -36,6 +36,7 @@
|
|||
# include <QGLFormat>
|
||||
# include <QGLWidget>
|
||||
# include <QGLPixelBuffer>
|
||||
# include <QMessageBox>
|
||||
# include <QPainter>
|
||||
# include <QPrinter>
|
||||
# include <QPrintDialog>
|
||||
|
@ -531,6 +532,13 @@ void View3DInventor::print(QPrinter* printer)
|
|||
#else
|
||||
QImage img;
|
||||
QPainter p(printer);
|
||||
if (!p.isActive() && !printer->outputFileName().isEmpty()) {
|
||||
qApp->setOverrideCursor(Qt::ArrowCursor);
|
||||
QMessageBox::critical(this, tr("Opening file failed"),
|
||||
tr("Can't open file '%1' for writing.").arg(printer->outputFileName()));
|
||||
qApp->restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
QRect rect = printer->pageRect();
|
||||
|
||||
bool pbuffer = QGLPixelBuffer::hasOpenGLPbuffers();
|
||||
|
|
|
@ -593,6 +593,13 @@ void DrawingView::print(QPrinter* printer)
|
|||
}
|
||||
|
||||
QPainter p(printer);
|
||||
if (!p.isActive() && !printer->outputFileName().isEmpty()) {
|
||||
qApp->setOverrideCursor(Qt::ArrowCursor);
|
||||
QMessageBox::critical(this, tr("Opening file failed"),
|
||||
tr("Can't open file '%1' for writing.").arg(printer->outputFileName()));
|
||||
qApp->restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
QRect rect = printer->paperRect();
|
||||
#ifdef Q_OS_WIN32
|
||||
// On Windows the preview looks broken when using paperRect as render area.
|
||||
|
|
Loading…
Reference in New Issue
Block a user