From 7c90a32b20c8fd3696ecdd431ee96d4d44e511ce Mon Sep 17 00:00:00 2001 From: fralx Date: Sun, 26 Dec 2021 13:40:55 +0300 Subject: [PATCH] Page geometry initialization has been fixed --- limereport/lrpageitemdesignintf.cpp | 17 ++++++++++++----- limereport/lrreportdesignwindow.cpp | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index f22eede..6d010a5 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -717,11 +717,17 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size) return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10, printer.paperSize(QPrinter::Millimeter).height() * 10); - #else - printer.setPageOrientation((QPageLayout::Orientation)pageOrientation()); - printer.setPageSize(QPageSize((QPageSize::PageSizeId)size)); - return QSizeF(printer.pageLayout().pageSize().size(QPageSize::Millimeter).width() * 10, - printer.pageLayout().pageSize().size(QPageSize::Millimeter).height() * 10); +#else + QPageSize pageSize = QPageSize((QPageSize::PageSizeId)size); + qreal width = pageSize.size(QPageSize::Millimeter).width() * 10; + qreal height = pageSize.size(QPageSize::Millimeter).height() * 10; + return QSizeF(pageOrientation() == Portrait ? width : height, + pageOrientation() == Portrait ? height : width); + +// printer.setPageOrientation((QPageLayout::Orientation)pageOrientation()); +// printer.setPageSize(QPageSize((QPageSize::PageSizeId)size)); +// return QSizeF(printer.pageLayout().pageSize().size(QPageSize::Millimeter).width() * 10, +// printer.pageLayout().pageSize().size(QPageSize::Millimeter).height() * 10); #endif } @@ -798,6 +804,7 @@ void PageItemDesignIntf::initPageSize(const PageItemDesignIntf::PageSize &size) m_sizeChainging = true; if (m_pageSize != Custom){ QSizeF pageSize = getRectByPageSize(size); + qDebug() << pageSize; setWidth(pageSize.width()); setHeight(pageSize.height()); } diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 2fbd9be..ccf7a93 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -502,7 +502,7 @@ void ReportDesignWindow::createBandsButton() connect(m_newTearOffBand,SIGNAL(triggered()),m_bandsAddSignalsMap,SLOT(map())); m_bandsAddSignalsMap->setMapping(m_newTearOffBand,BandDesignIntf::TearOffBand); m_newBandButton->addAction(m_newTearOffBand); -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3) +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1) connect(m_bandsAddSignalsMap,SIGNAL(mappedInt(int)),this,SLOT(slotNewBand(int))); #else connect(m_bandsAddSignalsMap,SIGNAL(mapped(int)),this,SLOT(slotNewBand(int))); @@ -533,7 +533,7 @@ void ReportDesignWindow::createMainMenu() m_infoMenu->addAction(m_aboutAction); m_recentFilesMenu = m_fileMenu->addMenu(tr("Recent Files")); m_recentFilesSignalMap = new QSignalMapper(this); -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3) +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1) connect(m_recentFilesSignalMap,SIGNAL(mappedString(QString)),this,SLOT(slotLoadRecentFile(QString))); #else connect(m_recentFilesSignalMap,SIGNAL(mapped(QString)),this,SLOT(slotLoadRecentFile(QString)));