Fix bug with landscape oriention.
--HG-- branch : develop
This commit is contained in:
parent
0deb90af92
commit
d2396820c5
|
@ -319,6 +319,7 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
|
||||||
details = lGenerator.GetAllDetailsItems();// All details items
|
details = lGenerator.GetAllDetailsItems();// All details items
|
||||||
detailsOnLayout = lGenerator.GetAllDetails();// All details items
|
detailsOnLayout = lGenerator.GetAllDetails();// All details items
|
||||||
shadows = CreateShadows(papers);
|
shadows = CreateShadows(papers);
|
||||||
|
isLayoutPortrait = lGenerator.IsPortrait();
|
||||||
scenes = CreateScenes(papers, shadows, details);
|
scenes = CreateScenes(papers, shadows, details);
|
||||||
//Uncomment to debug, shows global contour
|
//Uncomment to debug, shows global contour
|
||||||
// gcontours = lGenerator.GetGlobalContours(); // uncomment for debugging
|
// gcontours = lGenerator.GetGlobalContours(); // uncomment for debugging
|
||||||
|
@ -1522,7 +1523,7 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
|
||||||
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
|
printer->setCreator(QGuiApplication::applicationDisplayName()+QChar(QChar::Space)+
|
||||||
QCoreApplication::applicationVersion());
|
QCoreApplication::applicationVersion());
|
||||||
|
|
||||||
printer->setOrientation(QPrinter::Portrait);
|
printer->setOrientation(isLayoutPortrait ? QPrinter::Portrait : QPrinter::Landscape);
|
||||||
|
|
||||||
if (not isTiled)
|
if (not isTiled)
|
||||||
{
|
{
|
||||||
|
@ -1532,11 +1533,24 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
|
||||||
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
size = QSizeF(FromPixel(paperSize.width(), Unit::Mm),
|
if (isLayoutPortrait)
|
||||||
FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm));
|
{
|
||||||
|
size = QSizeF(FromPixel(paperSize.width(), Unit::Mm),
|
||||||
|
FromPixel(paper->rect().height() + margins.top() + margins.bottom(), Unit::Mm));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size = QSizeF(FromPixel(paper->rect().width() + margins.left() + margins.right(), Unit::Mm),
|
||||||
|
FromPixel(paperSize.height(), Unit::Mm));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (not isLayoutPortrait)
|
||||||
|
{
|
||||||
|
size.transpose(); // QPrinter reverse this for landscape orientation
|
||||||
|
}
|
||||||
|
|
||||||
const QPageSize::PageSizeId pSZ = FindPageSizeId(size);
|
const QPageSize::PageSizeId pSZ = FindPageSizeId(size);
|
||||||
if (pSZ == QPageSize::Custom)
|
if (pSZ == QPageSize::Custom)
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,6 +114,7 @@ protected:
|
||||||
bool isLayoutStale;
|
bool isLayoutStale;
|
||||||
bool isNeedAutosave;
|
bool isNeedAutosave;
|
||||||
bool ignorePrinterFields;
|
bool ignorePrinterFields;
|
||||||
|
bool isLayoutPortrait{true};
|
||||||
QMarginsF margins;
|
QMarginsF margins;
|
||||||
QSizeF paperSize;
|
QSizeF paperSize;
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,8 @@ public:
|
||||||
|
|
||||||
bool IsRotationNeeded() const;
|
bool IsRotationNeeded() const;
|
||||||
|
|
||||||
|
bool IsPortrait() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Abort();
|
void Abort();
|
||||||
void Timeout();
|
void Timeout();
|
||||||
|
@ -152,7 +154,6 @@ private:
|
||||||
|
|
||||||
int PageHeight() const;
|
int PageHeight() const;
|
||||||
int PageWidth() const;
|
int PageWidth() const;
|
||||||
bool IsPortrait() const;
|
|
||||||
|
|
||||||
void GatherPages();
|
void GatherPages();
|
||||||
void UnitePages();
|
void UnitePages();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user