From 38815727bbd4a3bcaf41313032d32d7ca6527621 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 11 Oct 2017 11:34:22 +0300 Subject: [PATCH] Fix bugs. ref #657. --HG-- branch : develop --- .../valentina/dialogs/dialogsavelayout.cpp | 6 +- src/app/valentina/dialogs/dialogsavelayout.ui | 616 ++++++++++-------- src/app/valentina/mainwindowsnogui.cpp | 18 +- src/libs/vlayout/vposter.cpp | 23 +- 4 files changed, 364 insertions(+), 299 deletions(-) diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index a036979e5..084ed87e0 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -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)); diff --git a/src/app/valentina/dialogs/dialogsavelayout.ui b/src/app/valentina/dialogs/dialogsavelayout.ui index 24a9b5e5c..4119c06b8 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.ui +++ b/src/app/valentina/dialogs/dialogsavelayout.ui @@ -6,8 +6,8 @@ 0 0 - 601 - 325 + 719 + 314 @@ -17,299 +17,353 @@ :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png - - - - - - - Path: - - - - - - - - - - 0 - 0 - - - - Destination folder - - - Path to destination folder - - - - - - - - 0 - 0 - - - - Select path to destination folder - - - Browse… - - - - - - - - - File format: - - - - - + + + + + Path: + + + + + + + - + 0 0 + + Destination folder + + + Path to destination folder + - - - - false + + + + + 0 + 0 + + + + Select path to destination folder - Binary form + Browse… - - - - true - - - Text as paths - - - - - - - 10 - - - - - true - - - Margins - - - false - - - - - - - - Right: - - - - - - - - - - - 71 - 0 - - - - - - - - Left: - - - - - - - - - - - Top: - - - - - - - - - - Bottom: - - - - - - - - - - - - - - - true - - - Paper format - - - - - - - - Templates: - - - - - - - - - - Orientation: - - - - - - - - - ... - - - - :/icon/16x16/portrait.png:/icon/16x16/portrait.png - - - true - - - true - - - true - - - - - - - ... - - - - :/icon/16x16/landscape.png:/icon/16x16/landscape.png - - - true - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - File name: - - - - - - - - - - 0 - 0 - - - - File base name - - - File base name - - - - - - - - 130 - 0 - - - - TextLabel - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - + + + + File format: + + + + + + + + 0 + 0 + + + + + + + + false + + + Binary form + + + + + + + true + + + Text as paths + + + + + + + + + true + + + Margins + + + false + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + Left: + + + + + + + + 0 + 0 + + + + Right: + + + + + + + cm + + + + + + + + 71 + 0 + + + + + + + cm + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + Top: + + + + + + + cm + + + + + + + + 0 + 0 + + + + Bottom: + + + + + + + cm + + + + + + + + + + + + true + + + Paper format + + + + + + + + Templates: + + + + + + + + + + Orientation: + + + + + + + + + ... + + + + :/icon/16x16/portrait.png:/icon/16x16/portrait.png + + + true + + + true + + + true + + + + + + + ... + + + + :/icon/16x16/landscape.png:/icon/16x16/landscape.png + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + File name: + + + + + + + + + + 0 + 0 + + + + File base name + + + File base name + + + + + + + + 130 + 0 + + + + TextLabel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + Qt::Horizontal diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index aea637516..d7ee003f9 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -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()); + printer->setOrientation(QPrinter::Portrait); + if (not isTiled) { - printer->setOrientation(QPrinter::Portrait); - 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); diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index 287d02dd7..81b686b3d 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -84,6 +84,11 @@ QVector 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,7 +185,14 @@ int VPoster::CountRows(int height, PageOrientation orientation) const pageLength = PageRect().height(); } - return qCeil(imgLength/(pageLength - static_cast(allowance))); + if (pageLength >= imgLength) + { + return 1; + } + else + { + return qCeil(imgLength/(pageLength - static_cast(allowance))); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -198,7 +210,14 @@ int VPoster::CountColumns(int width, PageOrientation orientation) const pageLength = PageRect().width(); } - return qCeil(imgLength/(pageLength-static_cast(allowance))); + if (pageLength >= imgLength) + { + return 1; + } + else + { + return qCeil(imgLength/(pageLength-static_cast(allowance))); + } } //---------------------------------------------------------------------------------------------------------------------