Fix bugs. ref #657.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-10-11 11:34:22 +03:00
parent 8cbf143592
commit 38815727bb
4 changed files with 364 additions and 299 deletions

View File

@ -157,7 +157,6 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
connect(ui->toolButtonPortrait, &QToolButton::toggled, this, &DialogSaveLayout::WriteSettings);
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogSaveLayout::WriteSettings);
ShowExample();//Show example for current format.
}
@ -754,6 +753,11 @@ void DialogSaveLayout::ReadSettings()
ui->doubleSpinBoxRightField->setValue(margins.right());
ui->doubleSpinBoxBottomField->setValue(margins.bottom());
ui->doubleSpinBoxLeftField->setSuffix(UnitsToStr(unit, true));
ui->doubleSpinBoxTopField->setSuffix(UnitsToStr(unit, true));
ui->doubleSpinBoxRightField->setSuffix(UnitsToStr(unit, true));
ui->doubleSpinBoxBottomField->setSuffix(UnitsToStr(unit, true));
// read Template
const QSizeF size = QSizeF(settings->GetTiledPDFPaperWidth(Unit::Mm), settings->GetTiledPDFPaperHeight(Unit::Mm));

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>325</height>
<width>719</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
@ -17,9 +17,7 @@
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -101,10 +99,7 @@
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="bottomMargin">
<number>10</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QGroupBox" name="groupBoxMargins">
<property name="enabled">
@ -116,18 +111,44 @@
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelLeftField">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Left:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelRightField">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Right:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxRightField"/>
<widget class="QDoubleSpinBox" name="doubleSpinBoxRightField">
<property name="suffix">
<string>cm</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxLeftField">
@ -137,38 +158,73 @@
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelLeftField">
<property name="text">
<string>Left:</string>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string>cm</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelTopField">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Top:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxTopField"/>
<widget class="QDoubleSpinBox" name="doubleSpinBoxTopField">
<property name="suffix">
<string>cm</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelBottomField">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Bottom:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxBottomField"/>
<widget class="QDoubleSpinBox" name="doubleSpinBoxBottomField">
<property name="suffix">
<string>cm</string>
</property>
</widget>
</item>
</layout>
</item>
@ -307,9 +363,7 @@
</item>
</layout>
</item>
</layout>
</item>
<item>
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>

View File

@ -1100,7 +1100,7 @@ void MainWindowsNoGUI::RestorePaper(int index) const
if (paper)
{
// Restore
paper->setPen(QPen(Qt::black, widthMainLine));
paper->setPen(QPen(Qt::black, 1));
QBrush brush(Qt::gray);
scenes.at(index)->setBackgroundBrush(brush);
shadows.at(index)->setVisible(true);
@ -1248,10 +1248,10 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
SCASSERT(printer != nullptr)
printer->setCreator(QGuiApplication::applicationDisplayName()+" "+QCoreApplication::applicationVersion());
if (not isTiled)
{
printer->setOrientation(QPrinter::Portrait);
if (not isTiled)
{
QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm));
if (isAutoCrop || isUnitePages)
{
@ -1273,18 +1273,6 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
printer->setPaperSize (pSZ);
}
}
else
{
VSettings *settings = qApp->ValentinaSettings();
if(settings->GetTiledPDFOrientation() == PageOrientation::Landscape)
{
printer->setOrientation(QPrinter::Landscape);
}
else
{
printer->setOrientation(QPrinter::Portrait);
}
}
printer->setFullPage(ignorePrinterFields);

View File

@ -84,6 +84,11 @@ QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterDat
QPen pen(Qt::NoBrush, 1, Qt::DashLine);
pen.setColor(Qt::black);
if (img.columns == 1 && img.rows == 1)
{
return data;
}
const QRect rec = img.rect;
if (img.column != 0)
{// Left border
@ -180,8 +185,15 @@ int VPoster::CountRows(int height, PageOrientation orientation) const
pageLength = PageRect().height();
}
if (pageLength >= imgLength)
{
return 1;
}
else
{
return qCeil(imgLength/(pageLength - static_cast<int>(allowance)));
}
}
//---------------------------------------------------------------------------------------------------------------------
int VPoster::CountColumns(int width, PageOrientation orientation) const
@ -198,8 +210,15 @@ int VPoster::CountColumns(int width, PageOrientation orientation) const
pageLength = PageRect().width();
}
if (pageLength >= imgLength)
{
return 1;
}
else
{
return qCeil(imgLength/(pageLength-static_cast<int>(allowance)));
}
}
//---------------------------------------------------------------------------------------------------------------------
PosterData VPoster::Cut(int i, int j, const QRect &imageRect, PageOrientation orientation) const