issue #570 tiled pdf case when margin smaller than min
--HG-- branch : feature
This commit is contained in:
parent
8da35622d1
commit
ae9da263ab
|
@ -33,6 +33,7 @@
|
|||
#include "../vformat/vmeasurements.h"
|
||||
#include "../vmisc/commandoptions.h"
|
||||
#include "../vmisc/vsettings.h"
|
||||
#include <QDebug>
|
||||
|
||||
VCommandLinePtr VCommandLine::instance = nullptr;
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <QKeyEvent>
|
||||
#include <QApplication>
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "../vpropertyexplorer/vproperty.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
|
||||
#include <QDockWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace VPE;
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
||||
#include "../xml/vpattern.h"
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include <QDebug>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QtDebug>
|
||||
#include <QRegularExpression>
|
||||
|
||||
const QString baseFilenameRegExp = QStringLiteral("^[\\w\\-. ]+$");
|
||||
|
||||
|
|
|
@ -383,7 +383,27 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
|||
// Render
|
||||
QRectF source;
|
||||
isTiled ? source = poster->at(index).rect : source = paper->rect();
|
||||
QRectF target(0, 0, source.width() * scale, source.height() * scale);
|
||||
|
||||
qreal x,y;
|
||||
if(printer->fullPage())
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
|
||||
QMarginsF printerMargins = printer->pageLayout().margins();
|
||||
x = qFloor(ToPixel(printerMargins.left(),Unit::Mm));
|
||||
y = qFloor(ToPixel(printerMargins.top(),Unit::Mm));
|
||||
#else
|
||||
qreal left = 0, top = 0, right = 0, bottom = 0;
|
||||
printer->getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
|
||||
x = qFloor(ToPixel(left,Unit::Mm));
|
||||
y = qFloor(ToPixel(top,Unit::Mm));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0; y = 0;
|
||||
}
|
||||
|
||||
QRectF target(x * scale, y * scale, source.width() * scale, source.height() * scale);
|
||||
|
||||
scenes.at(paperIndex)->render(&painter, target, source, Qt::IgnoreAspectRatio);
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include <QMessageBox>
|
||||
#include <QUndoStack>
|
||||
#include <QtNumeric>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
|
||||
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <QStringData>
|
||||
#include <QStringDataPtr>
|
||||
#include <QtGlobal>
|
||||
#include <QLocale>
|
||||
|
||||
#include "../ifc/ifcdef.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
|
|
@ -267,8 +267,28 @@ QRect VPoster::PageRect() const
|
|||
// we can't use method pageRect(QPrinter::Point). Our dpi value can be different.
|
||||
// We convert value yourself to pixels.
|
||||
const QRectF rect = printer->pageRect(QPrinter::Millimeter);
|
||||
const QRect pageRect(0, 0, qFloor(ToPixel(rect.width())), qFloor(ToPixel(rect.height())));
|
||||
return pageRect;
|
||||
|
||||
if(printer->fullPage())
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
|
||||
QMarginsF pMargins = printer->pageLayout().margins();
|
||||
QRectF newRect = rect.marginsRemoved(pMargins);
|
||||
const QRect pageRectFP(0, 0, qFloor(ToPixel(newRect.width())), qFloor(ToPixel(newRect.height())));
|
||||
return pageRectFP;
|
||||
#else
|
||||
qreal left = 0 , top = 0, right = 0, bottom = 0;
|
||||
printer->getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
|
||||
qreal newWidth = rect.width()-left-right;
|
||||
qreal newHeight = rect.height()-top-bottom;
|
||||
const QRect pageRectFP(0, 0, qFloor(ToPixel(newWidth)), qFloor(ToPixel(newHeight)));
|
||||
return pageRectFP;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
const QRect pageRect(0, 0, qFloor(ToPixel(rect.width())), qFloor(ToPixel(rect.height())));
|
||||
return pageRect;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <QDomElement>
|
||||
#include <QPointF>
|
||||
#include <QUndoCommand>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../ifc/ifcdef.h"
|
||||
|
|
Loading…
Reference in New Issue
Block a user