Fix strip optimization. It must follow paper sheet orientation settings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-01-02 16:49:57 +02:00
parent d5d8104d3a
commit 25fc7227f0
2 changed files with 17 additions and 5 deletions

View File

@ -115,18 +115,23 @@ void VLayoutGenerator::Generate()
if (bank->Prepare())
{
const int width = PageWidth();
int width = PageWidth();
int height = PageHeight();
if (stripOptimization)
{
const qreal b = bank->GetBiggestDiagonal() * multiplier + bank->GetLayoutWidth();
if (height >= b*2)
auto SetStrip = [this, b](int &side)
{
stripOptimizationEnabled = true;
height = qFloor(height / qFloor(height/b));
}
if (side >= b*2)
{
stripOptimizationEnabled = true;
side = qFloor(side / qFloor(side/b));
}
};
IsPortrait() ? SetStrip(height) : SetStrip(width);
}
while (bank->AllDetailsCount() > 0)
@ -306,6 +311,12 @@ int VLayoutGenerator::PageWidth() const
return static_cast<int>(paperWidth - (margins.left() + margins.right()));
}
//---------------------------------------------------------------------------------------------------------------------
bool VLayoutGenerator::IsPortrait() const
{
return PageHeight() >= PageWidth();
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::GatherPages()
{

View File

@ -147,6 +147,7 @@ private:
int PageHeight() const;
int PageWidth() const;
bool IsPortrait() const;
void GatherPages();
void UnitePages();