Page geometry initialization has been fixed

This commit is contained in:
fralx 2021-12-26 13:40:55 +03:00
parent 8dab5f6870
commit 7c90a32b20
2 changed files with 14 additions and 7 deletions

View File

@ -718,10 +718,16 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size)
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);
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());
}

View File

@ -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)));