0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-01-12 09:31:04 +03:00

Merge tag '1.5.90' into develop

Finish 1.5.90
This commit is contained in:
Alexander Arin 2021-10-05 17:42:59 +03:00
commit 10060fa07f
4 changed files with 56 additions and 38 deletions

View File

@ -5,11 +5,11 @@ find_package(PNG REQUIRED)
find_package( find_package(
QT NAMES Qt6 Qt5 QT NAMES Qt6 Qt5
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport Script UiTools COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport UiTools
) )
find_package( find_package(
Qt${QT_VERSION_MAJOR} Qt${QT_VERSION_MAJOR}
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport Script UiTools COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport UiTools
) )
# Old Qt does not provide QT_VERSION_MAJOR # Old Qt does not provide QT_VERSION_MAJOR
@ -282,13 +282,13 @@ ${PROJECT_NAME}/translationeditor/languageselectdialog.ui
${PROJECT_NAME}/translationeditor/translationeditor.ui ${PROJECT_NAME}/translationeditor/translationeditor.ui
./${PROJECT_NAME}/databrowser/lrdatabrowser.qrc ${PROJECT_NAME}/databrowser/lrdatabrowser.qrc
./${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc ${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc
./${PROJECT_NAME}/items/items.qrc ${PROJECT_NAME}/items/items.qrc
./${PROJECT_NAME}/objectinspector/lobjectinspector.qrc ${PROJECT_NAME}/objectinspector/lobjectinspector.qrc
./${PROJECT_NAME}/report.qrc ${PROJECT_NAME}/report.qrc
./${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.qrc ${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.qrc
./${PROJECT_NAME}/translationeditor/translationeditor.qrc ${PROJECT_NAME}/translationeditor/translationeditor.qrc
) )
if (ENABLE_ZINT) if (ENABLE_ZINT)
@ -409,7 +409,6 @@ target_link_libraries( ${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Xml
Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Sql
Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::PrintSupport
Qt${QT_VERSION_MAJOR}::Script
Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::UiTools) Qt${QT_VERSION_MAJOR}::UiTools)

View File

@ -40,6 +40,7 @@ public:
void activateItemSelectionMode(); void activateItemSelectionMode();
void deleteSelectedItems(); void deleteSelectedItems();
void activateCurrentPage(); void activateCurrentPage();
void resize(ScaleType scaleType, int percent=0);
public slots: public slots:
void refreshPages(); void refreshPages();

View File

@ -330,19 +330,14 @@ void PreviewReportWidget::setScalePercent(int percent)
void PreviewReportWidget::fitWidth() void PreviewReportWidget::fitWidth()
{ {
if (d_ptr->currentPage()){ if (d_ptr->currentPage()){
qreal scalePercent = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); resize(m_scaleType = FitWidth);
setScalePercent(scalePercent*100);
m_scaleType = FitWidth;
} }
} }
void PreviewReportWidget::fitPage() void PreviewReportWidget::fitPage()
{ {
if (d_ptr->currentPage()){ if (d_ptr->currentPage()){
qreal vScale = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); resize(m_scaleType = FitPage);
qreal hScale = ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height();
setScalePercent(qMin(vScale,hScale)*100);
m_scaleType = FitPage;
} }
} }
@ -438,6 +433,28 @@ void PreviewReportWidget::activateCurrentPage()
page->setCurrentPage(d_ptr->currentPage().data()); page->setCurrentPage(d_ptr->currentPage().data());
} }
void PreviewReportWidget::resize(ScaleType scaleType, int percent)
{
switch (scaleType) {
case FitWidth:
setScalePercent(ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width()*100);
break;
case FitPage:
setScalePercent(qMin(
ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(),
ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height()
) * 100);
break;
case OneToOne:
setScalePercent(100);
break;
case Percents:
setScalePercent(percent);
break;
}
}
void PreviewReportWidget::slotSliderMoved(int value) void PreviewReportWidget::slotSliderMoved(int value)
{ {
if (m_scaleChanging) return; if (m_scaleChanging) return;

View File

@ -40,6 +40,7 @@ public:
void activateItemSelectionMode(); void activateItemSelectionMode();
void deleteSelectedItems(); void deleteSelectedItems();
void activateCurrentPage(); void activateCurrentPage();
void resize(ScaleType scaleType, int percent=0);
public slots: public slots:
void refreshPages(); void refreshPages();