From 9825ee78c17bcc9059cefd682a495a9381939bd0 Mon Sep 17 00:00:00 2001 From: MultiMote Date: Mon, 13 Sep 2021 15:38:17 +0300 Subject: [PATCH 1/2] Remove QtScript dependency in CMakeLists --- CMakeLists.txt | 61 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6711a62..5c5a193 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ find_package(PNG REQUIRED) find_package( 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( 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 @@ -37,7 +37,7 @@ include(GNUInstallDirs) include(CMakePackageConfigHelpers) -set ( LIMEREPORT_SOURCES +set ( LIMEREPORT_SOURCES ${PROJECT_NAME}/bands/lrdataband.cpp ${PROJECT_NAME}/bands/lrgroupbands.cpp ${PROJECT_NAME}/bands/lrpagefooter.cpp @@ -282,13 +282,13 @@ ${PROJECT_NAME}/translationeditor/languageselectdialog.ui ${PROJECT_NAME}/translationeditor/translationeditor.ui -./${PROJECT_NAME}/databrowser/lrdatabrowser.qrc -./${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc -./${PROJECT_NAME}/items/items.qrc -./${PROJECT_NAME}/objectinspector/lobjectinspector.qrc -./${PROJECT_NAME}/report.qrc -./${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.qrc -./${PROJECT_NAME}/translationeditor/translationeditor.qrc +${PROJECT_NAME}/databrowser/lrdatabrowser.qrc +${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc +${PROJECT_NAME}/items/items.qrc +${PROJECT_NAME}/objectinspector/lobjectinspector.qrc +${PROJECT_NAME}/report.qrc +${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.qrc +${PROJECT_NAME}/translationeditor/translationeditor.qrc ) if (ENABLE_ZINT) @@ -402,30 +402,29 @@ if (LIMEREPORT_STATIC AND ENABLE_ZINT) endif(LIMEREPORT_STATIC AND ENABLE_ZINT) -target_link_libraries( ${PROJECT_NAME} PUBLIC - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Widgets - Qt${QT_VERSION_MAJOR}::Qml - Qt${QT_VERSION_MAJOR}::Xml - Qt${QT_VERSION_MAJOR}::Sql - Qt${QT_VERSION_MAJOR}::PrintSupport - Qt${QT_VERSION_MAJOR}::Script - Qt${QT_VERSION_MAJOR}::Svg +target_link_libraries( ${PROJECT_NAME} PUBLIC + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Xml + Qt${QT_VERSION_MAJOR}::Sql + Qt${QT_VERSION_MAJOR}::PrintSupport + Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::UiTools) - + target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_QT5 -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -DHAVE_UI_LOADER -D_CRT_SECURE_NO_WARNINGS) -target_include_directories( ${PROJECT_NAME} PRIVATE - limereport/ - limereport/base - limereport/bands - limereport/databrowser - limereport/items/editors - limereport/items - limereport/objectinspector - limereport/scriptbrowser - limereport/serializators +target_include_directories( ${PROJECT_NAME} PRIVATE + limereport/ + limereport/base + limereport/bands + limereport/databrowser + limereport/items/editors + limereport/items + limereport/objectinspector + limereport/scriptbrowser + limereport/serializators limereport/scripteditor ) - + install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib From 02cf3ed6c153c719c346753ba77b0d27975444c0 Mon Sep 17 00:00:00 2001 From: Alexander Arin Date: Tue, 5 Oct 2021 17:42:37 +0300 Subject: [PATCH 2/2] resize function has been added to the report preview widget --- include/lrpreviewreportwidget.h | 1 + limereport/lrpreviewreportwidget.cpp | 31 +++++++++++++++++++++------- limereport/lrpreviewreportwidget.h | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/lrpreviewreportwidget.h b/include/lrpreviewreportwidget.h index 797acdb..9a9eab7 100644 --- a/include/lrpreviewreportwidget.h +++ b/include/lrpreviewreportwidget.h @@ -40,6 +40,7 @@ public: void activateItemSelectionMode(); void deleteSelectedItems(); void activateCurrentPage(); + void resize(ScaleType scaleType, int percent=0); public slots: void refreshPages(); diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 43ea2cc..71b4d35 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -320,19 +320,14 @@ void PreviewReportWidget::setScalePercent(int percent) void PreviewReportWidget::fitWidth() { if (d_ptr->currentPage()){ - qreal scalePercent = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); - setScalePercent(scalePercent*100); - m_scaleType = FitWidth; + resize(m_scaleType = FitWidth); } } void PreviewReportWidget::fitPage() { if (d_ptr->currentPage()){ - qreal vScale = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width(); - qreal hScale = ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height(); - setScalePercent(qMin(vScale,hScale)*100); - m_scaleType = FitPage; + resize(m_scaleType = FitPage); } } @@ -428,6 +423,28 @@ void PreviewReportWidget::activateCurrentPage() 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) { if (m_scaleChanging) return; diff --git a/limereport/lrpreviewreportwidget.h b/limereport/lrpreviewreportwidget.h index 797acdb..9a9eab7 100644 --- a/limereport/lrpreviewreportwidget.h +++ b/limereport/lrpreviewreportwidget.h @@ -40,6 +40,7 @@ public: void activateItemSelectionMode(); void deleteSelectedItems(); void activateCurrentPage(); + void resize(ScaleType scaleType, int percent=0); public slots: void refreshPages();