diff --git a/.travis.yml b/.travis.yml index 065513a..eec76b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -520,7 +520,7 @@ matrix: - make - make check - - env: Qt5.12.6_Ubuntu_18.04 + - env: Qt5.12.10_Ubuntu_18.04 os: linux dist: bionic language: cpp @@ -529,7 +529,7 @@ matrix: addons: apt: sources: - - sourceline: 'ppa:beineri/opt-qt-5.12.6-bionic' + - sourceline: 'ppa:beineri/opt-qt-5.12.10-bionic' packages: - qt512base - qt512script @@ -544,7 +544,7 @@ matrix: - make - make check - - env: Qt5.12.6_Ubuntu_18.04 + - env: Qt5.12.10_Ubuntu_18.04 os: linux dist: bionic language: cpp @@ -553,7 +553,7 @@ matrix: addons: apt: sources: - - sourceline: 'ppa:beineri/opt-qt-5.12.6-bionic' + - sourceline: 'ppa:beineri/opt-qt-5.12.10-bionic' packages: - qt512base - qt512script @@ -616,7 +616,7 @@ matrix: - make - make check - - env: Qt5.14.0_Ubuntu_18.04 + - env: Qt5.14.2_Ubuntu_18.04 os: linux dist: bionic language: cpp @@ -625,7 +625,7 @@ matrix: addons: apt: sources: - - sourceline: 'ppa:beineri/opt-qt-5.14.0-bionic' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' packages: - qt514base - qt514script @@ -640,7 +640,7 @@ matrix: - make - make check - - env: Qt5.14.0_Ubuntu_18.04 + - env: Qt5.14.2_Ubuntu_18.04 os: linux dist: bionic language: cpp @@ -649,7 +649,7 @@ matrix: addons: apt: sources: - - sourceline: 'ppa:beineri/opt-qt-5.14.0-bionic' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' packages: - qt514base - qt514script @@ -662,7 +662,55 @@ matrix: - source /opt/qt514/bin/qt514-env.sh - /opt/qt514/bin/qmake -r limereport.pro - make - - make check + - make check + + - env: Qt5.15.2_Ubuntu_18.04 + os: linux + dist: bionic + language: cpp + compiler: gcc + cache: ccache + addons: + apt: + sources: + - sourceline: 'ppa:beineri/opt-qt-5.15.2-bionic' + packages: + - qt515base + - qt515script + - qt515tools + - qt515svg + - mesa-common-dev + - libgl1-mesa-dev + + script: + - source /opt/qt515/bin/qt515-env.sh + - /opt/qt515/bin/qmake -r limereport.pro + - make + - make check + + - env: Qt5.15.2_Ubuntu_18.04 + os: linux + dist: bionic + language: cpp + compiler: clang + cache: ccache + addons: + apt: + sources: + - sourceline: 'ppa:beineri/opt-qt-5.15.2-bionic' + packages: + - qt515base + - qt515script + - qt515tools + - qt515svg + - mesa-common-dev + - libgl1-mesa-dev + + script: + - source /opt/qt515/bin/qt515-env.sh + - /opt/qt515/bin/qmake -r limereport.pro + - make + - make check notifications: email: false diff --git a/3rdparty/3rdparty.pro b/3rdparty/3rdparty.pro index 75d28ff..ba9ba93 100644 --- a/3rdparty/3rdparty.pro +++ b/3rdparty/3rdparty.pro @@ -1,5 +1,8 @@ -ZINT_PATH = $$PWD/zint-2.6.1/ +ZINT_PATH = $$PWD/zint-2.6.1 ZINT_VERSION = 2.6.1 INCLUDEPATH += $${ZINT_PATH}/backend $${ZINT_PATH}/backend_qt DEPENDPATH += $${ZINT_PATH}/backend $${ZINT_PATH}/backend_qt include($${ZINT_PATH}/backend_qt/backend_qt.pro) + +CONFIG -= warn_on +CONFIG += warn_off diff --git a/3rdparty/zint-2.6.1/backend_qt/backend_qt.pro b/3rdparty/zint-2.6.1/backend_qt/backend_qt.pro index 1efb6b2..a1cd0ba 100644 --- a/3rdparty/zint-2.6.1/backend_qt/backend_qt.pro +++ b/3rdparty/zint-2.6.1/backend_qt/backend_qt.pro @@ -1,13 +1,13 @@ DEFINES += NO_PNG TEMPLATE = lib -contains(CONFIG, static_build){ +CONFIG(static_build) { message(Static Build) CONFIG += staticlib DEFINES += QZINT_STATIC_BUILD } -!contains(CONFIG, staticlib){ +!CONFIG(staticlib) { CONFIG += dll DEFINES += QZINT_LIBRARY } @@ -24,11 +24,13 @@ unix{ } INCLUDEPATH += $$PWD/../backend -DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\" -CONFIG(release, debug|release){ - TARGET = QtZint + +DEFINES += ZINT_VERSION=\\\"$$ZINT_VERSION\\\" + +CONFIG(release, debug|release) { + TARGET = QtZint } else { - TARGET = QtZintd + TARGET = QtZintd } !contains(DEFINES, NO_PNG) { @@ -36,38 +38,30 @@ CONFIG(release, debug|release){ LIBS += -lpng } - -win32-msvc* { - DEFINES += _CRT_SECURE_NO_WARNINGS - #QMAKE_CFLAGS += /TP /wd4018 /wd4244 /wd4305 - #QMAKE_CXXFLAGS += /TP /wd4018 /wd4244 /wd4305 -} - - INCLUDEPATH += zint zint/backend zint/backend_qt -HEADERS += $$PWD/../backend/aztec.h \ - $$PWD/../backend/bmp.h \ - $$PWD/../backend/code49.h \ - $$PWD/../backend/common.h \ - $$PWD/../backend/composite.h \ - $$PWD/../backend/dmatrix.h \ - $$PWD/../backend/eci.h \ - $$PWD/../backend/font.h \ - $$PWD/../backend/gridmtx.h \ - $$PWD/../backend/gs1.h \ - $$PWD/../backend/hanxin.h \ - $$PWD/../backend/large.h \ - $$PWD/../backend/maxicode.h \ - $$PWD/../backend/pcx.h \ - $$PWD/../backend/pdf417.h \ - $$PWD/../backend/reedsol.h \ - $$PWD/../backend/rss.h \ - $$PWD/../backend/sjis.h \ - $$PWD/../backend/stdint_msvc.h \ - $$PWD/../backend/zint.h \ - $$PWD/qzint.h \ - $$PWD/qzint_global.h +HEADERS += $$PWD/../backend/aztec.h \ + $$PWD/../backend/bmp.h \ + $$PWD/../backend/code49.h \ + $$PWD/../backend/common.h \ + $$PWD/../backend/composite.h \ + $$PWD/../backend/dmatrix.h \ + $$PWD/../backend/eci.h \ + $$PWD/../backend/font.h \ + $$PWD/../backend/gridmtx.h \ + $$PWD/../backend/gs1.h \ + $$PWD/../backend/hanxin.h \ + $$PWD/../backend/large.h \ + $$PWD/../backend/maxicode.h \ + $$PWD/../backend/pcx.h \ + $$PWD/../backend/pdf417.h \ + $$PWD/../backend/reedsol.h \ + $$PWD/../backend/rss.h \ + $$PWD/../backend/sjis.h \ + $$PWD/../backend/stdint_msvc.h \ + $$PWD/../backend/zint.h \ + $$PWD/qzint.h \ + $$PWD/qzint_global.h SOURCES += $$PWD/../backend/2of5.c \ $$PWD/../backend/auspost.c \ diff --git a/CMakeLists.txt b/CMakeLists.txt index bd44bfc..6711a62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,339 +1,441 @@ project(limereport) -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.14) -find_package(Qt5Core) -find_package(Qt5Widgets) -find_package(Qt5Sql) -find_package(Qt5Network) -find_package(Qt5Xml) -find_package(Qt5Svg) -find_package(Qt5Qml) -find_package(Qt5PrintSupport) -find_package(Qt5Script) -find_package(Qt5UiTools) find_package(PNG REQUIRED) + +find_package( + QT NAMES Qt6 Qt5 + COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport Script UiTools + ) +find_package( + Qt${QT_VERSION_MAJOR} + COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport Script UiTools + ) + +# Old Qt does not provide QT_VERSION_MAJOR +if (NOT QT_VERSION_MAJOR) + string(SUBSTRING ${QT_VERSION} 0 1 QT_VERSION_MAJOR) +endif() + +message(STATUS "Qt version: ${QT_VERSION_MAJOR}") +if (Qt${QT_VERSION_MAJOR}Widgets_FOUND) + message(STATUS "QtGui found") +endif() +if (Qt${QT_VERSION_MAJOR}Widgets_FOUND) + message(STATUS "QtWidgets found") +endif() + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + set ( LIMEREPORT_SOURCES -limereport/bands/lrdataband.cpp -limereport/bands/lrgroupbands.cpp -limereport/bands/lrpagefooter.cpp -limereport/bands/lrpageheader.cpp -limereport/bands/lrreportfooter.cpp -limereport/bands/lrreportheader.cpp -limereport/bands/lrsubdetailband.cpp -limereport/bands/lrtearoffband.cpp -limereport/databrowser/lrconnectiondialog.cpp -limereport/databrowser/lrdatabrowser.cpp -limereport/databrowser/lrdatabrowsertree.cpp -limereport/databrowser/lrsqleditdialog.cpp -limereport/databrowser/lrvariabledialog.cpp -limereport/exporters/lrpdfexporter.cpp -limereport/items/charts/lrhorizontalbarchart.cpp -limereport/items/charts/lrlineschart.cpp -limereport/items/charts/lrpiechart.cpp -limereport/items/charts/lrverticalbarchart.cpp -limereport/items/editors/lrfonteditorwidget.cpp -limereport/items/editors/lritemeditorwidget.cpp -limereport/items/editors/lritemsaligneditorwidget.cpp -limereport/items/editors/lritemsborderseditorwidget.cpp -limereport/items/editors/lrtextalignmenteditorwidget.cpp -limereport/items/lrabstractlayout.cpp -limereport/items/lralignpropitem.cpp -limereport/items/lrbarcodeitem.cpp -limereport/items/lrchartitem.cpp -limereport/items/lrchartitemeditor.cpp -limereport/items/lrhorizontallayout.cpp -limereport/items/lrimageitem.cpp -limereport/items/lrimageitemeditor.cpp -limereport/items/lrlayoutmarker.cpp -limereport/items/lrshapeitem.cpp -limereport/items/lrsimpletagparser.cpp -limereport/items/lrsubitemparentpropitem.cpp -limereport/items/lrsvgitem.cpp -limereport/items/lrtextitem.cpp -limereport/items/lrtextitemeditor.cpp -limereport/items/lrverticallayout.cpp -limereport/lraboutdialog.cpp -limereport/lrbanddesignintf.cpp -limereport/lrbandsmanager.cpp -limereport/lrbasedesignintf.cpp -limereport/lrcolorindicator.cpp -limereport/lrdatadesignintf.cpp -limereport/lrdatasourcemanager.cpp -limereport/lrfactoryinitializer.cpp -limereport/lrglobal.cpp -limereport/lrgraphicsviewzoom.cpp -limereport/lrgroupfunctions.cpp -limereport/lritemdesignintf.cpp -limereport/lritemscontainerdesignitf.cpp -limereport/lrpagedesignintf.cpp -limereport/lrpageitemdesignintf.cpp -limereport/lrpreparedpages.cpp -limereport/lrpreviewreportwidget.cpp -limereport/lrpreviewreportwindow.cpp -limereport/lrreportdesignwidget.cpp -limereport/lrreportdesignwindow.cpp -limereport/lrreportengine.cpp -limereport/lrreportrender.cpp -limereport/lrreporttranslation.cpp -limereport/lrscriptenginemanager.cpp -limereport/lrsettingdialog.cpp -limereport/lrsimplecrypt.cpp -limereport/lrvariablesholder.cpp -limereport/objectinspector/editors/lrbuttonlineeditor.cpp -limereport/objectinspector/editors/lrcheckboxeditor.cpp -limereport/objectinspector/editors/lrcoloreditor.cpp -limereport/objectinspector/editors/lrcomboboxeditor.cpp -limereport/objectinspector/editors/lrfonteditor.cpp -limereport/objectinspector/editors/lrimageeditor.cpp -limereport/objectinspector/editors/lrsvgeditor.cpp -limereport/objectinspector/editors/lrtextitempropertyeditor.cpp -limereport/objectinspector/lrbasedesignobjectmodel.cpp -limereport/objectinspector/lrobjectinspectorwidget.cpp -limereport/objectinspector/lrobjectitemmodel.cpp -limereport/objectinspector/lrobjectpropitem.cpp -limereport/objectinspector/lrpropertydelegate.cpp -limereport/objectinspector/propertyItems/lrboolpropitem.cpp -limereport/objectinspector/propertyItems/lrcolorpropitem.cpp -limereport/objectinspector/propertyItems/lrcontentpropitem.cpp -limereport/objectinspector/propertyItems/lrdatasourcepropitem.cpp -limereport/objectinspector/propertyItems/lrenumpropitem.cpp -limereport/objectinspector/propertyItems/lrflagspropitem.cpp -limereport/objectinspector/propertyItems/lrfontpropitem.cpp -limereport/objectinspector/propertyItems/lrgroupfieldpropitem.cpp -limereport/objectinspector/propertyItems/lrimagepropitem.cpp -limereport/objectinspector/propertyItems/lrintpropitem.cpp -limereport/objectinspector/propertyItems/lrmarginpropitem.cpp -limereport/objectinspector/propertyItems/lrqrealpropitem.cpp -limereport/objectinspector/propertyItems/lrrectproptem.cpp -limereport/objectinspector/propertyItems/lrseriespropitem.cpp -limereport/objectinspector/propertyItems/lrstringpropitem.cpp -limereport/objectinspector/propertyItems/lrsvgpropitem.cpp -limereport/objectsbrowser/lrobjectbrowser.cpp -limereport/scriptbrowser/lrscriptbrowser.cpp -limereport/scripteditor/lrcodeeditor.cpp -limereport/scripteditor/lrscripteditor.cpp -limereport/scripteditor/lrscripthighlighter.cpp -limereport/serializators/lrxmlbasetypesserializators.cpp -limereport/serializators/lrxmlqrectserializator.cpp -limereport/serializators/lrxmlreader.cpp -limereport/serializators/lrxmlwriter.cpp -limereport/translationeditor/languageselectdialog.cpp -limereport/translationeditor/translationeditor.cpp +${PROJECT_NAME}/bands/lrdataband.cpp +${PROJECT_NAME}/bands/lrgroupbands.cpp +${PROJECT_NAME}/bands/lrpagefooter.cpp +${PROJECT_NAME}/bands/lrpageheader.cpp +${PROJECT_NAME}/bands/lrreportfooter.cpp +${PROJECT_NAME}/bands/lrreportheader.cpp +${PROJECT_NAME}/bands/lrsubdetailband.cpp +${PROJECT_NAME}/bands/lrtearoffband.cpp +${PROJECT_NAME}/databrowser/lrconnectiondialog.cpp +${PROJECT_NAME}/databrowser/lrdatabrowser.cpp +${PROJECT_NAME}/databrowser/lrdatabrowsertree.cpp +${PROJECT_NAME}/databrowser/lrsqleditdialog.cpp +${PROJECT_NAME}/databrowser/lrvariabledialog.cpp +${PROJECT_NAME}/exporters/lrpdfexporter.cpp +${PROJECT_NAME}/items/charts/lrhorizontalbarchart.cpp +${PROJECT_NAME}/items/charts/lrlineschart.cpp +${PROJECT_NAME}/items/charts/lrpiechart.cpp +${PROJECT_NAME}/items/charts/lrverticalbarchart.cpp +${PROJECT_NAME}/items/editors/lrfonteditorwidget.cpp +${PROJECT_NAME}/items/editors/lritemeditorwidget.cpp +${PROJECT_NAME}/items/editors/lritemsaligneditorwidget.cpp +${PROJECT_NAME}/items/editors/lritemsborderseditorwidget.cpp +${PROJECT_NAME}/items/editors/lrtextalignmenteditorwidget.cpp +${PROJECT_NAME}/items/lrabstractlayout.cpp +${PROJECT_NAME}/items/lralignpropitem.cpp +${PROJECT_NAME}/items/lrchartitem.cpp +${PROJECT_NAME}/items/lrchartitemeditor.cpp +${PROJECT_NAME}/items/lrhorizontallayout.cpp +${PROJECT_NAME}/items/lrimageitem.cpp +${PROJECT_NAME}/items/lrimageitemeditor.cpp +${PROJECT_NAME}/items/lrlayoutmarker.cpp +${PROJECT_NAME}/items/lrshapeitem.cpp +${PROJECT_NAME}/items/lrsimpletagparser.cpp +${PROJECT_NAME}/items/lrsubitemparentpropitem.cpp +${PROJECT_NAME}/items/lrsvgitem.cpp +${PROJECT_NAME}/items/lrtextitem.cpp +${PROJECT_NAME}/items/lrtextitemeditor.cpp +${PROJECT_NAME}/items/lrverticallayout.cpp +${PROJECT_NAME}/lraboutdialog.cpp +${PROJECT_NAME}/lrbanddesignintf.cpp +${PROJECT_NAME}/lrbandsmanager.cpp +${PROJECT_NAME}/lrbasedesignintf.cpp +${PROJECT_NAME}/lrcolorindicator.cpp +${PROJECT_NAME}/lrdatadesignintf.cpp +${PROJECT_NAME}/lrdatasourcemanager.cpp +${PROJECT_NAME}/lrglobal.cpp +${PROJECT_NAME}/lrgraphicsviewzoom.cpp +${PROJECT_NAME}/lrgroupfunctions.cpp +${PROJECT_NAME}/lritemdesignintf.cpp +${PROJECT_NAME}/lritemscontainerdesignitf.cpp +${PROJECT_NAME}/lrpagedesignintf.cpp +${PROJECT_NAME}/lrpageitemdesignintf.cpp +${PROJECT_NAME}/lrpreparedpages.cpp +${PROJECT_NAME}/lrpreviewreportwidget.cpp +${PROJECT_NAME}/lrpreviewreportwindow.cpp +${PROJECT_NAME}/lrreportdesignwidget.cpp +${PROJECT_NAME}/lrreportdesignwindow.cpp +${PROJECT_NAME}/lrreportengine.cpp +${PROJECT_NAME}/lrreportrender.cpp +${PROJECT_NAME}/lrreporttranslation.cpp +${PROJECT_NAME}/lrscriptenginemanager.cpp +${PROJECT_NAME}/lrsettingdialog.cpp +${PROJECT_NAME}/lrsimplecrypt.cpp +${PROJECT_NAME}/lrvariablesholder.cpp +${PROJECT_NAME}/objectinspector/editors/lrbuttonlineeditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrcheckboxeditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrcoloreditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrcomboboxeditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrfonteditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrimageeditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrsvgeditor.cpp +${PROJECT_NAME}/objectinspector/editors/lrtextitempropertyeditor.cpp +${PROJECT_NAME}/objectinspector/lrbasedesignobjectmodel.cpp +${PROJECT_NAME}/objectinspector/lrobjectinspectorwidget.cpp +${PROJECT_NAME}/objectinspector/lrobjectitemmodel.cpp +${PROJECT_NAME}/objectinspector/lrobjectpropitem.cpp +${PROJECT_NAME}/objectinspector/lrpropertydelegate.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrboolpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrcolorpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrcontentpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrdatasourcepropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrenumpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrflagspropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrfontpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrgroupfieldpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrimagepropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrintpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrmarginpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrqrealpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrrectproptem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrseriespropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrstringpropitem.cpp +${PROJECT_NAME}/objectinspector/propertyItems/lrsvgpropitem.cpp +${PROJECT_NAME}/objectsbrowser/lrobjectbrowser.cpp +${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.cpp +${PROJECT_NAME}/scripteditor/lrcodeeditor.cpp +${PROJECT_NAME}/scripteditor/lrscripteditor.cpp +${PROJECT_NAME}/scripteditor/lrscripthighlighter.cpp +${PROJECT_NAME}/serializators/lrxmlbasetypesserializators.cpp +${PROJECT_NAME}/serializators/lrxmlqrectserializator.cpp +${PROJECT_NAME}/serializators/lrxmlreader.cpp +${PROJECT_NAME}/serializators/lrxmlwriter.cpp +${PROJECT_NAME}/translationeditor/languageselectdialog.cpp +${PROJECT_NAME}/translationeditor/translationeditor.cpp -limereport/bands/lrdataband.h -limereport/bands/lrgroupbands.h -limereport/bands/lrpagefooter.h -limereport/bands/lrpageheader.h -limereport/bands/lrreportfooter.h -limereport/bands/lrreportheader.h -limereport/bands/lrsubdetailband.h -limereport/bands/lrtearoffband.h -limereport/base/lrattribsabstractfactory.h -limereport/base/lrsimpleabstractfactory.h -limereport/base/lrsingleton.h -limereport/databrowser/lrconnectiondialog.h -limereport/databrowser/lrdatabrowser.h -limereport/databrowser/lrdatabrowsertree.h -limereport/databrowser/lrsqleditdialog.h -limereport/databrowser/lrvariabledialog.h -limereport/exporters/lrpdfexporter.h -limereport/items/charts/lrhorizontalbarchart.h -limereport/items/charts/lrlineschart.h -limereport/items/charts/lrpiechart.h -limereport/items/charts/lrverticalbarchart.h -limereport/items/editors/lrfonteditorwidget.h -limereport/items/editors/lritemeditorwidget.h -limereport/items/editors/lritemsaligneditorwidget.h -limereport/items/editors/lritemsborderseditorwidget.h -limereport/items/editors/lrtextalignmenteditorwidget.h -limereport/items/lrabstractlayout.h -limereport/items/lralignpropitem.h -limereport/items/lrbarcodeitem.h -limereport/items/lrchartitem.h -limereport/items/lrchartitemeditor.h -limereport/items/lreditableimageitemintf.h -limereport/items/lrhorizontallayout.h -limereport/items/lrimageitem.h -limereport/items/lrimageitemeditor.h -limereport/items/lrlayoutmarker.h -limereport/items/lrshapeitem.h -limereport/items/lrsimpletagparser.h -limereport/items/lrsubitemparentpropitem.h -limereport/items/lrsvgitem.h -limereport/items/lrtextitem.h -limereport/items/lrtextitemeditor.h -limereport/items/lrverticallayout.h -limereport/lraboutdialog.h -limereport/lrbanddesignintf.h -limereport/lrbandsmanager.h -limereport/lrbasedesignintf.h -limereport/lrcallbackdatasourceintf.h -limereport/lrcollection.h -limereport/lrcolorindicator.h -limereport/lrdatadesignintf.h -limereport/lrdatasourceintf.h -limereport/lrdatasourcemanager.h -limereport/lrdatasourcemanagerintf.h -limereport/lrdesignelementsfactory.h -limereport/lrdesignerplugininterface.h -limereport/lrexporterintf.h -limereport/lrexportersfactory.h -limereport/lrfactoryinitializer.h -limereport/lrgraphicsviewzoom.h -limereport/lrgroupfunctions.h -limereport/lritemdesignintf.h -limereport/lritemscontainerdesignitf.h -limereport/lrpagedesignintf.h -limereport/lrpageinitintf.h -limereport/lrpageitemdesignintf.h -limereport/lrpreparedpages.h -limereport/lrpreparedpagesintf.h -limereport/lrpreviewreportwidget.h -limereport/lrpreviewreportwidget_p.h -limereport/lrpreviewreportwindow.h -limereport/lrreportdesignwidget.h -limereport/lrreportdesignwindow.h -limereport/lrreportdesignwindowintrerface.h -limereport/lrreportengine.h -limereport/lrreportengine_p.h -limereport/lrreportrender.h -limereport/lrreporttranslation.h -limereport/lrscriptenginemanager.h -limereport/lrscriptenginemanagerintf.h -limereport/lrsettingdialog.h -limereport/lrsimplecrypt.h -limereport/lrvariablesholder.h -limereport/objectinspector/editors/lrbuttonlineeditor.h -limereport/objectinspector/editors/lrcheckboxeditor.h -limereport/objectinspector/editors/lrcoloreditor.h -limereport/objectinspector/editors/lrcomboboxeditor.h -limereport/objectinspector/editors/lrfonteditor.h -limereport/objectinspector/editors/lrimageeditor.h -limereport/objectinspector/editors/lrsvgeditor.h -limereport/objectinspector/editors/lrtextitempropertyeditor.h -limereport/objectinspector/lrbasedesignobjectmodel.h -limereport/objectinspector/lrobjectinspectorwidget.h -limereport/objectinspector/lrobjectitemmodel.h -limereport/objectinspector/lrobjectpropitem.h -limereport/objectinspector/lrpropertydelegate.h -limereport/objectinspector/propertyItems/lrboolpropitem.h -limereport/objectinspector/propertyItems/lrcolorpropitem.h -limereport/objectinspector/propertyItems/lrcontentpropitem.h -limereport/objectinspector/propertyItems/lrdatasourcepropitem.h -limereport/objectinspector/propertyItems/lrenumpropitem.h -limereport/objectinspector/propertyItems/lrflagspropitem.h -limereport/objectinspector/propertyItems/lrfontpropitem.h -limereport/objectinspector/propertyItems/lrgroupfieldpropitem.h -limereport/objectinspector/propertyItems/lrimagepropitem.h -limereport/objectinspector/propertyItems/lrintpropitem.h -limereport/objectinspector/propertyItems/lrmarginpropitem.h -limereport/objectinspector/propertyItems/lrqrealpropitem.h -limereport/objectinspector/propertyItems/lrrectproptem.h -limereport/objectinspector/propertyItems/lrseriespropitem.h -limereport/objectinspector/propertyItems/lrstringpropitem.h -limereport/objectinspector/propertyItems/lrsvgpropitem.h -limereport/objectsbrowser/lrobjectbrowser.h -limereport/scriptbrowser/lrscriptbrowser.h -limereport/scripteditor/lrcodeeditor.h -limereport/scripteditor/lrscripteditor.h -limereport/scripteditor/lrscripthighlighter.h -limereport/serializators/lrserializatorintf.h -limereport/serializators/lrstorageintf.h -limereport/serializators/lrxmlbasetypesserializators.h -limereport/serializators/lrxmlqrectserializator.h -limereport/serializators/lrxmlreader.h -limereport/serializators/lrxmlserializatorsfactory.h -limereport/serializators/lrxmlwriter.h -limereport/translationeditor/languageselectdialog.h -limereport/translationeditor/translationeditor.h -limereport/lrglobal.h +${PROJECT_NAME}/bands/lrdataband.h +${PROJECT_NAME}/bands/lrgroupbands.h +${PROJECT_NAME}/bands/lrpagefooter.h +${PROJECT_NAME}/bands/lrpageheader.h +${PROJECT_NAME}/bands/lrreportfooter.h +${PROJECT_NAME}/bands/lrreportheader.h +${PROJECT_NAME}/bands/lrsubdetailband.h +${PROJECT_NAME}/bands/lrtearoffband.h +${PROJECT_NAME}/base/lrattribsabstractfactory.h +${PROJECT_NAME}/base/lrsimpleabstractfactory.h +${PROJECT_NAME}/base/lrsingleton.h +${PROJECT_NAME}/databrowser/lrconnectiondialog.h +${PROJECT_NAME}/databrowser/lrdatabrowser.h +${PROJECT_NAME}/databrowser/lrdatabrowsertree.h +${PROJECT_NAME}/databrowser/lrsqleditdialog.h +${PROJECT_NAME}/databrowser/lrvariabledialog.h +${PROJECT_NAME}/exporters/lrpdfexporter.h +${PROJECT_NAME}/items/charts/lrhorizontalbarchart.h +${PROJECT_NAME}/items/charts/lrlineschart.h +${PROJECT_NAME}/items/charts/lrpiechart.h +${PROJECT_NAME}/items/charts/lrverticalbarchart.h +${PROJECT_NAME}/items/editors/lrfonteditorwidget.h +${PROJECT_NAME}/items/editors/lritemeditorwidget.h +${PROJECT_NAME}/items/editors/lritemsaligneditorwidget.h +${PROJECT_NAME}/items/editors/lritemsborderseditorwidget.h +${PROJECT_NAME}/items/editors/lrtextalignmenteditorwidget.h +${PROJECT_NAME}/items/lrabstractlayout.h +${PROJECT_NAME}/items/lralignpropitem.h +${PROJECT_NAME}/items/lrchartitem.h +${PROJECT_NAME}/items/lrchartitemeditor.h +${PROJECT_NAME}/items/lreditableimageitemintf.h +${PROJECT_NAME}/items/lrhorizontallayout.h +${PROJECT_NAME}/items/lrimageitem.h +${PROJECT_NAME}/items/lrimageitemeditor.h +${PROJECT_NAME}/items/lrlayoutmarker.h +${PROJECT_NAME}/items/lrshapeitem.h +${PROJECT_NAME}/items/lrsimpletagparser.h +${PROJECT_NAME}/items/lrsubitemparentpropitem.h +${PROJECT_NAME}/items/lrsvgitem.h +${PROJECT_NAME}/items/lrtextitem.h +${PROJECT_NAME}/items/lrtextitemeditor.h +${PROJECT_NAME}/items/lrverticallayout.h +${PROJECT_NAME}/lraboutdialog.h +${PROJECT_NAME}/lrbanddesignintf.h +${PROJECT_NAME}/lrbandsmanager.h +${PROJECT_NAME}/lrbasedesignintf.h +${PROJECT_NAME}/lrcollection.h +${PROJECT_NAME}/lrcolorindicator.h +${PROJECT_NAME}/lrdatadesignintf.h +${PROJECT_NAME}/lrdatasourcemanager.h +${PROJECT_NAME}/lrdesignelementsfactory.h +${PROJECT_NAME}/lrdesignerplugininterface.h +${PROJECT_NAME}/lrexporterintf.h +${PROJECT_NAME}/lrexportersfactory.h +${PROJECT_NAME}/lrgraphicsviewzoom.h +${PROJECT_NAME}/lrgroupfunctions.h +${PROJECT_NAME}/lritemdesignintf.h +${PROJECT_NAME}/lritemscontainerdesignitf.h +${PROJECT_NAME}/lrpagedesignintf.h +${PROJECT_NAME}/lrpageinitintf.h +${PROJECT_NAME}/lrpageitemdesignintf.h +${PROJECT_NAME}/lrpreparedpages.h +${PROJECT_NAME}/lrpreviewreportwidget_p.h +${PROJECT_NAME}/lrpreviewreportwindow.h +${PROJECT_NAME}/lrreportdesignwidget.h +${PROJECT_NAME}/lrreportdesignwindow.h +${PROJECT_NAME}/lrreportengine_p.h +${PROJECT_NAME}/lrreportrender.h +${PROJECT_NAME}/lrreporttranslation.h +${PROJECT_NAME}/lrscriptenginemanager.h +${PROJECT_NAME}/lrsettingdialog.h +${PROJECT_NAME}/lrsimplecrypt.h +${PROJECT_NAME}/lrvariablesholder.h +${PROJECT_NAME}/objectinspector/editors/lrbuttonlineeditor.h +${PROJECT_NAME}/objectinspector/editors/lrcheckboxeditor.h +${PROJECT_NAME}/objectinspector/editors/lrcoloreditor.h +${PROJECT_NAME}/objectinspector/editors/lrcomboboxeditor.h +${PROJECT_NAME}/objectinspector/editors/lrfonteditor.h +${PROJECT_NAME}/objectinspector/editors/lrimageeditor.h +${PROJECT_NAME}/objectinspector/editors/lrsvgeditor.h +${PROJECT_NAME}/objectinspector/editors/lrtextitempropertyeditor.h +${PROJECT_NAME}/objectinspector/lrbasedesignobjectmodel.h +${PROJECT_NAME}/objectinspector/lrobjectinspectorwidget.h +${PROJECT_NAME}/objectinspector/lrobjectitemmodel.h +${PROJECT_NAME}/objectinspector/lrobjectpropitem.h +${PROJECT_NAME}/objectinspector/lrpropertydelegate.h +${PROJECT_NAME}/objectinspector/propertyItems/lrboolpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrcolorpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrcontentpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrdatasourcepropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrenumpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrflagspropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrfontpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrgroupfieldpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrimagepropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrintpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrmarginpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrqrealpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrrectproptem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrseriespropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrstringpropitem.h +${PROJECT_NAME}/objectinspector/propertyItems/lrsvgpropitem.h +${PROJECT_NAME}/objectsbrowser/lrobjectbrowser.h +${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.h +${PROJECT_NAME}/scripteditor/lrcodeeditor.h +${PROJECT_NAME}/scripteditor/lrscripteditor.h +${PROJECT_NAME}/scripteditor/lrscripthighlighter.h +${PROJECT_NAME}/serializators/lrserializatorintf.h +${PROJECT_NAME}/serializators/lrstorageintf.h +${PROJECT_NAME}/serializators/lrxmlbasetypesserializators.h +${PROJECT_NAME}/serializators/lrxmlqrectserializator.h +${PROJECT_NAME}/serializators/lrxmlreader.h +${PROJECT_NAME}/serializators/lrxmlserializatorsfactory.h +${PROJECT_NAME}/serializators/lrxmlwriter.h +${PROJECT_NAME}/translationeditor/languageselectdialog.h +${PROJECT_NAME}/translationeditor/translationeditor.h -3rdparty/zint-2.6.1/backend/2of5.c -3rdparty/zint-2.6.1/backend/auspost.c -3rdparty/zint-2.6.1/backend/aztec.c -3rdparty/zint-2.6.1/backend/bmp.c -3rdparty/zint-2.6.1/backend/codablock.c -3rdparty/zint-2.6.1/backend/code.c -3rdparty/zint-2.6.1/backend/code1.c -3rdparty/zint-2.6.1/backend/code128.c -3rdparty/zint-2.6.1/backend/code16k.c -3rdparty/zint-2.6.1/backend/code49.c -3rdparty/zint-2.6.1/backend/common.c -3rdparty/zint-2.6.1/backend/composite.c -3rdparty/zint-2.6.1/backend/dllversion.c -3rdparty/zint-2.6.1/backend/dmatrix.c -3rdparty/zint-2.6.1/backend/dotcode.c -3rdparty/zint-2.6.1/backend/eci.c -3rdparty/zint-2.6.1/backend/emf.c -3rdparty/zint-2.6.1/backend/gif.c -3rdparty/zint-2.6.1/backend/gridmtx.c -3rdparty/zint-2.6.1/backend/gs1.c -3rdparty/zint-2.6.1/backend/hanxin.c -3rdparty/zint-2.6.1/backend/imail.c -3rdparty/zint-2.6.1/backend/large.c -3rdparty/zint-2.6.1/backend/library.c -3rdparty/zint-2.6.1/backend/libzint.rc -3rdparty/zint-2.6.1/backend/maxicode.c -3rdparty/zint-2.6.1/backend/medical.c -3rdparty/zint-2.6.1/backend/pcx.c -3rdparty/zint-2.6.1/backend/pdf417.c -3rdparty/zint-2.6.1/backend/plessey.c -3rdparty/zint-2.6.1/backend/png.c -3rdparty/zint-2.6.1/backend/postal.c -3rdparty/zint-2.6.1/backend/ps.c -3rdparty/zint-2.6.1/backend/qr.c -3rdparty/zint-2.6.1/backend/raster.c -3rdparty/zint-2.6.1/backend/reedsol.c -3rdparty/zint-2.6.1/backend/render.c -3rdparty/zint-2.6.1/backend/rss.c -3rdparty/zint-2.6.1/backend/svg.c -3rdparty/zint-2.6.1/backend/telepen.c -3rdparty/zint-2.6.1/backend/tif.c -3rdparty/zint-2.6.1/backend/upcean.c -3rdparty/zint-2.6.1/backend_qt/qzint.cpp + +${PROJECT_NAME}/databrowser/lrconnectiondialog.ui +${PROJECT_NAME}/databrowser/lrdatabrowser.ui +${PROJECT_NAME}/databrowser/lrsqleditdialog.ui +${PROJECT_NAME}/databrowser/lrvariabledialog.ui +${PROJECT_NAME}/dialogdesigner/templates/Dialog.ui +${PROJECT_NAME}/items/lrchartitemeditor.ui +${PROJECT_NAME}/items/lrimageitemeditor.ui +${PROJECT_NAME}/items/lrtextitemeditor.ui +${PROJECT_NAME}/lraboutdialog.ui +${PROJECT_NAME}/lrpreviewreportwidget.ui +${PROJECT_NAME}/lrpreviewreportwindow.ui +${PROJECT_NAME}/lrsettingdialog.ui +${PROJECT_NAME}/objectinspector/editors/ltextitempropertyeditor.ui +${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.ui +${PROJECT_NAME}/scripteditor/lrscripteditor.ui +${PROJECT_NAME}/translationeditor/languageselectdialog.ui +${PROJECT_NAME}/translationeditor/translationeditor.ui -limereport/databrowser/lrconnectiondialog.ui -limereport/databrowser/lrdatabrowser.ui -limereport/databrowser/lrsqleditdialog.ui -limereport/databrowser/lrvariabledialog.ui -limereport/dialogdesigner/templates/Dialog.ui -limereport/items/lrchartitemeditor.ui -limereport/items/lrimageitemeditor.ui -limereport/items/lrtextitemeditor.ui -limereport/lraboutdialog.ui -limereport/lrpreviewreportwidget.ui -limereport/lrpreviewreportwindow.ui -limereport/lrsettingdialog.ui -limereport/objectinspector/editors/ltextitempropertyeditor.ui -limereport/scriptbrowser/lrscriptbrowser.ui -limereport/scripteditor/lrscripteditor.ui -limereport/translationeditor/languageselectdialog.ui -limereport/translationeditor/translationeditor.ui - - -./limereport/databrowser/lrdatabrowser.qrc -./limereport/dialogdesigner/dialogdesigner.qrc -./limereport/items/items.qrc -./limereport/objectinspector/lobjectinspector.qrc -./limereport/report.qrc -./limereport/scriptbrowser/lrscriptbrowser.qrc -./limereport/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 ) -add_library( limereport_static STATIC ${LIMEREPORT_SOURCES}) -add_library( limereport SHARED ${LIMEREPORT_SOURCES}) -target_link_libraries( limereport_static PNG::PNG Qt5::Core Qt5::Qml Qt5::Widgets Qt5::Xml Qt5::Sql Qt5::PrintSupport Qt5::Script Qt5::Svg Qt5::UiTools) -target_link_libraries( limereport PNG::PNG Qt5::Core Qt5::Widgets Qt5::Qml Qt5::Xml Qt5::Sql Qt5::PrintSupport Qt5::Script Qt5::Svg Qt5::UiTools) -target_compile_definitions( limereport_static PUBLIC -DHAVE_QT5 -DHAVE_STATIC_BUILD -DLIMEREPORT_VERSION_STR="dev" -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -DHAVE_UI_LOADER ) -target_compile_definitions( limereport PUBLIC -DHAVE_QT5 -DLIMEREPORT_VERSION_STR="dev" -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -DLIMEREPORT_EXPORTS -DHAVE_UI_LOADER) -target_include_directories( limereport PRIVATE limereport/ limereport/base limereport/bands limereport/databrowser limereport/items/editors limereport/items limereport/objectinspector limereport/scriptbrowser limereport/serializators 3rdparty/zint-2.6.1/backend_qt 3rdparty/zint-2.6.1/backend limereport/scripteditor) -target_include_directories( limereport_static PRIVATE limereport/ limereport/base limereport/bands limereport/databrowser limereport/items/editors limereport/items limereport/objectinspector limereport/scriptbrowser limereport/serializators 3rdparty/zint-2.6.1/backend_qt 3rdparty/zint-2.6.1/backend limereport/scripteditor ) +if (ENABLE_ZINT) + list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/items/lrbarcodeitem.cpp) + list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/items/lrbarcodeitem.h) +endif(ENABLE_ZINT) + +if (LIMEREPORT_STATIC) + list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/lrfactoryinitializer.cpp) + list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/lrfactoryinitializer.h) +endif(LIMEREPORT_STATIC) + +set(EXTRA_FILES + ${PROJECT_NAME}/lrglobal.h + ${PROJECT_NAME}/lrdatasourcemanagerintf.h + ${PROJECT_NAME}/lrdatasourceintf.h + ${PROJECT_NAME}/lrreportengine.h + ${PROJECT_NAME}/lrscriptenginemanagerintf.h + ${PROJECT_NAME}/lrcallbackdatasourceintf.h + ${PROJECT_NAME}/lrpreviewreportwidget.h + ${PROJECT_NAME}/lrreportdesignwindowintrerface.h + ${PROJECT_NAME}/lrpreparedpagesintf.h +) + +set(ZINT_FILES + 3rdparty/zint-2.6.1/backend/2of5.c + 3rdparty/zint-2.6.1/backend/auspost.c + 3rdparty/zint-2.6.1/backend/aztec.c + 3rdparty/zint-2.6.1/backend/bmp.c + 3rdparty/zint-2.6.1/backend/codablock.c + 3rdparty/zint-2.6.1/backend/code.c + 3rdparty/zint-2.6.1/backend/code1.c + 3rdparty/zint-2.6.1/backend/code128.c + 3rdparty/zint-2.6.1/backend/code16k.c + 3rdparty/zint-2.6.1/backend/code49.c + 3rdparty/zint-2.6.1/backend/common.c + 3rdparty/zint-2.6.1/backend/composite.c + 3rdparty/zint-2.6.1/backend/dllversion.c + 3rdparty/zint-2.6.1/backend/dmatrix.c + 3rdparty/zint-2.6.1/backend/dotcode.c + 3rdparty/zint-2.6.1/backend/eci.c + 3rdparty/zint-2.6.1/backend/emf.c + 3rdparty/zint-2.6.1/backend/gif.c + 3rdparty/zint-2.6.1/backend/gridmtx.c + 3rdparty/zint-2.6.1/backend/gs1.c + 3rdparty/zint-2.6.1/backend/hanxin.c + 3rdparty/zint-2.6.1/backend/imail.c + 3rdparty/zint-2.6.1/backend/large.c + 3rdparty/zint-2.6.1/backend/library.c + 3rdparty/zint-2.6.1/backend/libzint.rc + 3rdparty/zint-2.6.1/backend/maxicode.c + 3rdparty/zint-2.6.1/backend/medical.c + 3rdparty/zint-2.6.1/backend/pcx.c + 3rdparty/zint-2.6.1/backend/pdf417.c + 3rdparty/zint-2.6.1/backend/plessey.c + 3rdparty/zint-2.6.1/backend/png.c + 3rdparty/zint-2.6.1/backend/postal.c + 3rdparty/zint-2.6.1/backend/ps.c + 3rdparty/zint-2.6.1/backend/qr.c + 3rdparty/zint-2.6.1/backend/raster.c + 3rdparty/zint-2.6.1/backend/reedsol.c + 3rdparty/zint-2.6.1/backend/render.c + 3rdparty/zint-2.6.1/backend/rss.c + 3rdparty/zint-2.6.1/backend/svg.c + 3rdparty/zint-2.6.1/backend/telepen.c + 3rdparty/zint-2.6.1/backend/tif.c + 3rdparty/zint-2.6.1/backend/upcean.c + 3rdparty/zint-2.6.1/backend_qt/qzint.cpp + ) + + + +set(LIMEREPORT_VERSION_MAJOR 1) +set(LIMEREPORT_VERSION_MINOR 5) +set(LIMEREPORT_VERSION_RELEASE 88) + +configure_file(config.h.in config.h @ONLY) + +set(GLOBAL_HEADERS + ${PROJECT_NAME}/LimeReport + ${PROJECT_NAME}/LRCallbackDS + ${PROJECT_NAME}/LRDataManager + ${PROJECT_NAME}/LRScriptManager + ${CMAKE_CURRENT_BINARY_DIR}/config.h + ) + +if(ENABLE_ZINT) + add_library(QZint STATIC ${ZINT_FILES}) +endif(ENABLE_ZINT) + +if (LIMEREPORT_STATIC) + message(STATUS "STATIC LIBRARY") + add_library(${PROJECT_NAME} STATIC ${EXTRA_FILES} ${LIMEREPORT_SOURCES}) + target_compile_definitions( ${PROJECT_NAME} PUBLIC -DHAVE_STATIC_BUILD) +else() + add_library(${PROJECT_NAME} SHARED ${EXTRA_FILES} ${LIMEREPORT_SOURCES}) + target_compile_definitions( ${PROJECT_NAME} PUBLIC -DLIMEREPORT_EXPORTS) +endif() + +target_compile_definitions(${PROJECT_NAME} PUBLIC -DCMAKE_CONFIG) +target_link_libraries( ${PROJECT_NAME} PRIVATE PNG::PNG) +if(ENABLE_ZINT) + target_link_libraries( ${PROJECT_NAME} PRIVATE QZint) + target_include_directories( ${PROJECT_NAME} PRIVATE + 3rdparty/zint-2.6.1/backend_qt + 3rdparty/zint-2.6.1/backend) +endif(ENABLE_ZINT) + +if (LIMEREPORT_STATIC AND ENABLE_ZINT) + target_compile_definitions( ${PROJECT_NAME} PRIVATE -DQZINT_STATIC_BUILD) +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 + 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 + limereport/scripteditor ) + +install(TARGETS + ${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + +install(FILES + ${EXTRA_FILES} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") + +install(FILES + ${GLOBAL_HEADERS} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") diff --git a/common.pri b/common.pri index 56cb45d..3a6d8d3 100644 --- a/common.pri +++ b/common.pri @@ -1,78 +1,89 @@ +# uncomment to disable translations +#CONFIG += no_build_translations + +# uncomment to disable zint +#CONFIG += no_zint + +# uncomment to disable svg +#CONFIG += no_svg + +# uncomment to enable easy_profiler +#CONFIG *= easy_profiler + isEmpty(BINARY_RESULT_DIR) { BINARY_RESULT_DIR = $${PWD} } -!contains(CONFIG, no_build_translations){ - CONFIG += build_translations +!CONFIG(no_build_translations) { + CONFIG *= build_translations } -#CONFIG *= easy_profiler -!contains(CONFIG, no_zint){ +!CONFIG(no_zint) { CONFIG *= zint } -!contains(CONGIG, no_svg){ +!CONFIG(no_svg) { QT *= svg CONFIG *= svg - DEFINES += HAVE_SVG + DEFINES *= HAVE_SVG } -INCLUDEPATH += $$PWD/3rdparty/easyprofiler/easy_profiler_core/include -DEPENDPATH += $$PWD/3rdparty/easyprofiler/easy_profiler_core/include - -contains(CONFIG, easy_profiler){ +CONFIG(easy_profiler) { message(EasyProfiler) - unix|win32: LIBS += -L$$PWD/3rdparty/easyprofiler/build/bin/ -leasy_profiler - greaterThan(QT_MAJOR_VERSION, 4){ - DEFINES += BUILD_WITH_EASY_PROFILER + INCLUDEPATH *= $$PWD/3rdparty/easyprofiler/easy_profiler_core/include + DEPENDPATH *= $$PWD/3rdparty/easyprofiler/easy_profiler_core/include + unix|win32: LIBS *= -L$$PWD/3rdparty/easyprofiler/build/bin/ -leasy_profiler + equals(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 6) { + DEFINES *= BUILD_WITH_EASY_PROFILER } } -!contains(CONFIG, qtscriptengine){ -greaterThan(QT_MAJOR_VERSION, 4){ -greaterThan(QT_MINOR_VERSION, 5){ - CONFIG *= qjsengine -} -lessThan(QT_MINOR_VERSION, 6){ - CONFIG *= qtscriptengine -} -} -lessThan(QT_MAJOR_VERSION, 5){ - CONFIG *= qtscriptengine -} +!CONFIG(qtscriptengine) { + equals(QT_MAJOR_VERSION, 4) { + CONFIG *= qtscriptengine + } + equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 6) { + CONFIG *= qtscriptengine + } + equals(QT_MAJOR_VERSION, 5) : greaterThan(QT_MINOR_VERSION, 5) { + CONFIG *= qjsengine + } + equals(QT_MAJOR_VERSION, 6) { + CONFIG *= qjsengine + } } -contains(CONFIG, qtscriptengine){ +CONFIG(qtscriptengine) { CONFIG -= qjsengine QT *= script DEFINES *= USE_QTSCRIPTENGINE message(qtscriptengine) } -!contains(CONFIG, no_formdesigner){ +!CONFIG(no_formdesigner) { CONFIG *= dialogdesigner } -!contains(CONFIG, no_embedded_designer){ +!CONFIG(no_embedded_designer) { CONFIG *= embedded_designer - DEFINES += HAVE_REPORT_DESIGNER + DEFINES *= HAVE_REPORT_DESIGNER message(embedded designer) } ZINT_PATH = $$PWD/3rdparty/zint-2.6.1 -contains(CONFIG,zint){ +CONFIG(zint) { DEFINES *= HAVE_ZINT } -greaterThan(QT_MAJOR_VERSION, 4) { - QT *= uitools -} - -lessThan(QT_MAJOR_VERSION, 5){ +equals(QT_MAJOR_VERSION, 4) { CONFIG *= uitools } -CONFIG(release, debug|release){ +equals(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 6) { + QT *= uitools +} + +CONFIG(release, debug|release) { message(Release) BUILD_TYPE = release }else{ @@ -83,39 +94,43 @@ CONFIG(release, debug|release){ BUILD_DIR = $${BINARY_RESULT_DIR}/build/$${QT_VERSION} DEST_INCLUDE_DIR = $$PWD/include + unix{ ARCH_DIR = $${OUT_PWD}/unix ARCH_TYPE = unix + macx{ - ARCH_DIR = $${OUT_PWD}/macx - ARCH_TYPE = macx + ARCH_DIR = $${OUT_PWD}/macx + ARCH_TYPE = macx } + linux{ - !contains(QT_ARCH, x86_64){ + !contains(QT_ARCH, x86_64) { message("Compiling for 32bit system") - ARCH_DIR = $${OUT_PWD}/linux32 - ARCH_TYPE = linux32 + ARCH_DIR = $${OUT_PWD}/linux32 + ARCH_TYPE = linux32 }else{ message("Compiling for 64bit system") - ARCH_DIR = $${OUT_PWD}/linux64 - ARCH_TYPE = linux64 + ARCH_DIR = $${OUT_PWD}/linux64 + ARCH_TYPE = linux64 } } } + win32 { !contains(QT_ARCH, x86_64) { message("Compiling for 32bit system") - ARCH_DIR = $${OUT_PWD}/win32 - ARCH_TYPE = win32 + ARCH_DIR = $${OUT_PWD}/win32 + ARCH_TYPE = win32 } else { message("Compiling for 64bit system") - ARCH_DIR = $${OUT_PWD}/win64 - ARCH_TYPE = win64 + ARCH_DIR = $${OUT_PWD}/win64 + ARCH_TYPE = win64 } } -DEST_LIBS = $${BUILD_DIR}/$${ARCH_TYPE}/$${BUILD_TYPE}/lib -DEST_BINS = $${BUILD_DIR}/$${ARCH_TYPE}/$${BUILD_TYPE}/$${TARGET} +DEST_LIBS = $${BUILD_DIR}/$${ARCH_TYPE}/$${BUILD_TYPE}/lib +DEST_BINS = $${BUILD_DIR}/$${ARCH_TYPE}/$${BUILD_TYPE}/$${TARGET} MOC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/moc UI_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/ui @@ -126,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 87 +LIMEREPORT_VERSION_RELEASE = 88 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" @@ -136,24 +151,24 @@ QT *= xml sql REPORT_PATH = $$PWD/limereport TRANSLATIONS_PATH = $$PWD/translations -greaterThan(QT_MAJOR_VERSION, 4) { - DEFINES *= HAVE_QT5 - QT *= printsupport widgets - contains(QT,uitools){ +equals(QT_MAJOR_VERSION, 4) { + DEFINES *= HAVE_QT4 + CONFIG(uitools) { message(uitools) DEFINES *= HAVE_UI_LOADER } - contains(CONFIG, qjsengine){ +} + +equals(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 6) { + DEFINES *= HAVE_QT5 + QT *= printsupport widgets + contains(QT, uitools) { + message(uitools) + DEFINES *= HAVE_UI_LOADER + } + CONFIG(qjsengine) { message(qjsengine) DEFINES *= USE_QJSENGINE QT *= qml } } - -lessThan(QT_MAJOR_VERSION, 5){ - DEFINES *= HAVE_QT4 - CONFIG(uitools){ - message(uitools) - DEFINES *= HAVE_UI_LOADER - } -} diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..dcb5e74 --- /dev/null +++ b/config.h.in @@ -0,0 +1,7 @@ +#pragma once + +#cmakedefine LIMEREPORT_VERSION_MAJOR "@LIMEREPORT_VERSION_MAJOR@" +#cmakedefine LIMEREPORT_VERSION_MINOR "@LIMEREPORT_VERSION_MINOR@" +#cmakedefine LIMEREPORT_VERSION_RELEASE "@LIMEREPORT_VERSION_RELEASE@" + +#define LIMEREPORT_VERSION_STR LIMEREPORT_VERSION_MAJOR"." LIMEREPORT_VERSION_MINOR"." LIMEREPORT_VERSION_RELEASE diff --git a/console/console.pro b/console/console.pro index cea280f..f12bc2d 100644 --- a/console/console.pro +++ b/console/console.pro @@ -23,13 +23,12 @@ CONFIG(debug, debug|release) { } else { LIBS += -llimereport } -!contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } + +!CONFIG(static_build) : CONFIG(zint) { + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint } } diff --git a/console/main.cpp b/console/main.cpp index 6bbd395..12a5085 100644 --- a/console/main.cpp +++ b/console/main.cpp @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) QApplication::setApplicationVersion(LIMEREPORT_VERSION_STR); QStringList vars; -#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0) +#if QT_VERSION > 0x050200 QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); diff --git a/demo_r1/demo_r1.pro b/demo_r1/demo_r1.pro index 36505d3..8b4266c 100644 --- a/demo_r1/demo_r1.pro +++ b/demo_r1/demo_r1.pro @@ -2,56 +2,56 @@ include(../common.pri) QT += core gui CONFIG(release, debug|release) { - TARGET = LRDemo_r1 + TARGET = LRDemo_r1 } else { - TARGET = LRDemo_r1d + TARGET = LRDemo_r1d } TEMPLATE = app -SOURCES += main.cpp\ - mainwindow.cpp +SOURCES += main.cpp \ + mainwindow.cpp -HEADERS += mainwindow.h +HEADERS += mainwindow.h -FORMS += mainwindow.ui +FORMS += mainwindow.ui INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include RESOURCES += \ - r1.qrc + r1.qrc EXTRA_DIR += $$PWD/demo_reports DEST_DIR = $${DEST_BINS} REPORTS_DIR = $${DEST_DIR} macx{ - CONFIG += app_bundle + CONFIG += app_bundle } unix:{ - DESTDIR = $$DEST_DIR - # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | - QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t) + DESTDIR = $$DEST_DIR + # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | + QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t) - linux{ - #Link share lib to ../lib rpath - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib - QMAKE_LFLAGS_RPATH += #. .. ./libs - } - target.path = $${DEST_DIR} - INSTALLS = target + linux{ + #Link share lib to ../lib rpath + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib + QMAKE_LFLAGS_RPATH += #. .. ./libs + } + target.path = $${DEST_DIR} + INSTALLS = target } win32 { DESTDIR = $$DEST_DIR - contains(QMAKE_HOST.os, Linux){ + contains(QMAKE_HOST.os, Linux) { QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t) } else { - EXTRA_DIR ~= s,/,\\,g + EXTRA_DIR ~= s,/,\\,g DEST_DIR ~= s,/,\\,g REPORTS_DIR ~= s,/,\\,g RC_FILE += mainicon.rc @@ -67,13 +67,11 @@ CONFIG(debug, debug|release) { } message($$LIBS) -!contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } +!CONFIG(static_build) : CONFIG(zint) { + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint + } } diff --git a/demo_r1/main.cpp b/demo_r1/main.cpp index 06ac390..72c8163 100644 --- a/demo_r1/main.cpp +++ b/demo_r1/main.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index 348cbb1..a7ea5c8 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/demo_r1/mainwindow.h b/demo_r1/mainwindow.h index e8d7ff1..271a907 100644 --- a/demo_r1/mainwindow.h +++ b/demo_r1/mainwindow.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/demo_r2/demo_r2.pro b/demo_r2/demo_r2.pro index c8abe1f..1a77367 100644 --- a/demo_r2/demo_r2.pro +++ b/demo_r2/demo_r2.pro @@ -1,16 +1,16 @@ include(../common.pri) QT += core gui -CONFIG(release, debug|release){ - TARGET = LRDemo_r2 +CONFIG(release, debug|release) { + TARGET = LRDemo_r2 } else { - TARGET = LRDemo_r2d + TARGET = LRDemo_r2d } TEMPLATE = app -SOURCES += main.cpp\ - mainwindow.cpp +SOURCES += main.cpp \ + mainwindow.cpp HEADERS += mainwindow.h @@ -20,7 +20,7 @@ INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include RESOURCES += \ - demo_r2.qrc + demo_r2.qrc EXTRA_DIR += $$PWD/demo_reports @@ -34,26 +34,26 @@ macx{ unix:{ DESTDIR = $$DEST_DIR QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t) - linux{ - #Link share lib to ../lib rpath - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib - QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib - QMAKE_LFLAGS_RPATH += #. .. ./libs - } + linux{ + #Link share lib to ../lib rpath + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib + QMAKE_LFLAGS_RPATH += #. .. ./libs + } target.path = $${DEST_DIR} INSTALLS = target } win32 { DESTDIR = $$DEST_DIR - contains(QMAKE_HOST.os, Linux){ + contains(QMAKE_HOST.os, Linux) { QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t) } else { - EXTRA_DIR ~= s,/,\\,g + EXTRA_DIR ~= s,/,\\,g DEST_DIR ~= s,/,\\,g - REPORTS_DIR ~= s,/,\\,g - RC_FILE += mainicon.rc + REPORTS_DIR ~= s,/,\\,g + RC_FILE += mainicon.rc QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) } } @@ -65,13 +65,11 @@ CONFIG(debug, debug|release) { LIBS += -llimereport } -!contains(CONFIG, static_build){ - contains(CONFIG,zint){ - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release) { - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } - } +!CONFIG(static_build) : CONFIG(zint) { + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint + } } diff --git a/demo_r2/mainwindow.cpp b/demo_r2/mainwindow.cpp index 6f2aa7b..f95b5a5 100644 --- a/demo_r2/mainwindow.cpp +++ b/demo_r2/mainwindow.cpp @@ -3,7 +3,11 @@ #include #include #include +#if QT_VERSION < 0x060000 #include +#else +#include +#endif MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -40,10 +44,17 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->actionOne_to_One, SIGNAL(triggered()), this, SLOT(slotOneToOne())); initPercentCombobox(); enableUI(false); +#if QT_VERSION < 0x060000 QDesktopWidget *desktop = QApplication::desktop(); int screenWidth = desktop->screenGeometry().width(); int screenHeight = desktop->screenGeometry().height(); +#else + QScreen *screen = QGuiApplication::primaryScreen(); + + int screenWidth = screen->geometry().width(); + int screenHeight = screen->geometry().height(); +#endif int x = screenWidth*0.1; int y = screenHeight*0.1; diff --git a/designer/designer.pro b/designer/designer.pro index 3f9cb8e..318f29a 100644 --- a/designer/designer.pro +++ b/designer/designer.pro @@ -1,18 +1,19 @@ include(../common.pri) QT += core gui -contains(CONFIG,release) { - TARGET = LRDesigner +CONFIG(release) { + TARGET = LRDesigner } else { - TARGET = LRDesignerd + TARGET = LRDesignerd } + TEMPLATE = app HEADERS += \ - designersettingmanager.h + designersettingmanager.h SOURCES += main.cpp \ - designersettingmanager.cpp + designersettingmanager.cpp INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include @@ -51,17 +52,15 @@ win32 { LIBS += -L$${DEST_LIBS} CONFIG(debug, debug|release) { - LIBS += -llimereportd + LIBS += -llimereportd } else { - LIBS += -llimereport + LIBS += -llimereport } -!contains(CONFIG, static_build){ - contains(CONFIG,zint){ - CONFIG(debug, debug|release) { - LIBS += -L$${DEST_LIBS} -lQtZintd - } else { - LIBS += -L$${DEST_LIBS} -lQtZint - } +!CONFIG(static_build) : CONFIG(zint) { + CONFIG(debug, debug|release) { + LIBS += -L$${DEST_LIBS} -lQtZintd + } else { + LIBS += -L$${DEST_LIBS} -lQtZint } } diff --git a/designer_plugin/designer_plugin.pro b/designer_plugin/designer_plugin.pro index 219a796..e610298 100644 --- a/designer_plugin/designer_plugin.pro +++ b/designer_plugin/designer_plugin.pro @@ -4,43 +4,43 @@ include(../common.pri) include(../limereport/limereport.pri) include(../limereport/designer.pri) -contains(CONFIG,release) { - TARGET = designer_plugin +CONFIG(release) { + TARGET = designer_plugin } else { - TARGET = designer_plugind + TARGET = designer_plugind } TEMPLATE = lib CONFIG += plugin HEADERS += \ - lrdesignerplugin.h + lrdesignerplugin.h SOURCES += \ - lrdesignerplugin.cpp + lrdesignerplugin.cpp INCLUDEPATH += $$PWD/../include DEPENDPATH += $$PWD/../include macx{ - CONFIG += lib_bundle - CONFIG += -dll + CONFIG += lib_bundle + CONFIG += -dll } -DESTDIR = $${DEST_LIBS} +DESTDIR = $${DEST_LIBS} unix { target.path = $${DESTDIR} INSTALLS = target } -contains(CONFIG,zint){ +CONFIG(zint) { message(zint) INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt - LIBS += -L$${DEST_LIBS} - CONFIG(debug, debug|release){ - LIBS += -lQtZintd - } else { - LIBS += -lQtZint - } + LIBS += -L$${DEST_LIBS} + CONFIG(debug, debug|release) { + LIBS += -lQtZintd + } else { + LIBS += -lQtZint + } } diff --git a/docs/Руководство пользователя.docx b/docs/Руководство пользователя.docx new file mode 100644 index 0000000..1d23e5c Binary files /dev/null and b/docs/Руководство пользователя.docx differ diff --git a/docs/Руководство пользователя.pdf b/docs/Руководство пользователя.pdf new file mode 100644 index 0000000..7bc6ee9 Binary files /dev/null and b/docs/Руководство пользователя.pdf differ diff --git a/include/LRCallbackDS b/include/LRCallbackDS index fd5f8c4..72e76a3 100644 --- a/include/LRCallbackDS +++ b/include/LRCallbackDS @@ -1 +1 @@ -#include "lrcallbackdatasourceintf.h" \ No newline at end of file +#include "lrcallbackdatasourceintf.h" diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h index 040dd1d..c43b239 100644 --- a/include/lrdatasourcemanagerintf.h +++ b/include/lrdatasourcemanagerintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/include/lrglobal.cpp b/include/lrglobal.cpp index 55ab31b..e8a31bb 100644 --- a/include/lrglobal.cpp +++ b/include/lrglobal.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -67,7 +67,11 @@ QString replaceHTMLSymbols(const QString &value) return result; } +#if QT_VERSION < 0x060000 QVector normalizeCaptures(const QRegExp& reg){ +#else +QVector normalizeCaptures(const QRegularExpressionMatch ®){ +#endif QVector result; foreach (QString cap, reg.capturedTexts()) { if (!cap.isEmpty()) diff --git a/include/lrglobal.h b/include/lrglobal.h index 8a312d8..f1da95f 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -51,7 +51,7 @@ namespace LimeReport { #define VARIABLE_IS_NOT_USED #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) +#if QT_VERSION >= 0x050800 Q_NAMESPACE #endif @@ -104,7 +104,11 @@ namespace Const{ QString extractClassName(QString className); QString escapeSimbols(const QString& value); QString replaceHTMLSymbols(const QString &value); +#if QT_VERSION < 0x060000 QVector normalizeCaptures(const QRegExp ®); +#else + QVector normalizeCaptures(const QRegularExpressionMatch ®); +#endif bool isColorDark(QColor color); enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; @@ -148,7 +152,7 @@ namespace Const{ virtual ~IPainterProxy(); }; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if QT_VERSION < 0x050000 typedef QStyleOptionViewItemV4 StyleOptionViewItem; #else typedef QStyleOptionViewItem StyleOptionViewItem; @@ -158,7 +162,7 @@ namespace Const{ { public: enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(VariableDataType) #else Q_ENUMS(VariableDataType) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 6509302..4fdfa37 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/include/lrscriptenginemanagerintf.h b/include/lrscriptenginemanagerintf.h index a8a7c63..573f748 100644 --- a/include/lrscriptenginemanagerintf.h +++ b/include/lrscriptenginemanagerintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -31,7 +31,7 @@ #define LRSCRIPTENGINEMANAGERINTF_H #include "qglobal.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) +#if QT_VERSION >= 0x050600 #ifndef USE_QTSCRIPTENGINE #ifndef USE_QJSENGINE #define USE_QJSENGINE diff --git a/limereport.pro b/limereport.pro index 9bc801f..449d892 100644 --- a/limereport.pro +++ b/limereport.pro @@ -1,31 +1,24 @@ TEMPLATE = subdirs -!contains(CONFIG, no_zint){ - CONFIG += zint -} - include(common.pri) -contains(CONFIG, zint){ + +CONFIG += ordered + +CONFIG(zint) { SUBDIRS += 3rdparty } -export($$CONFIG) - -CONFIG += ordered SUBDIRS += \ limereport \ demo_r1 \ demo_r2 \ + lrdview \ designer -greaterThan(QT_MAJOR_VERSION, 4){ -greaterThan(QT_MINOR_VERSION, 1){ - SUBDIRS += console - } +if(equals(QT_MAJOR_VERSION, 5) : greaterThan(QT_MINOR_VERSION, 1)) | equals(QT_MAJOR_VERSION, 6) { + SUBDIRS += console } -!contains(CONFIG, embedded_designer){ -!contains(CONFIG, static_build){ -SUBDIRS += designer_plugin -} +!CONFIG(embedded_designer) : !CONFIG(static_build) { + SUBDIRS += designer_plugin } diff --git a/limereport/bands/lrdataband.cpp b/limereport/bands/lrdataband.cpp index 7119440..9e81ba1 100644 --- a/limereport/bands/lrdataband.cpp +++ b/limereport/bands/lrdataband.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrdataband.h b/limereport/bands/lrdataband.h index c44c93c..ba0395c 100644 --- a/limereport/bands/lrdataband.h +++ b/limereport/bands/lrdataband.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -40,11 +40,11 @@ class DataBand : public DataBandDesignIntf { Q_OBJECT Q_PROPERTY(bool keepSubdetailTogether READ tryToKeepTogether WRITE setTryToKeepTogether) - Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable ) + Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable) Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether) Q_PROPERTY(bool sliceLastRow READ sliceLastRow WRITE setSliceLastRow) Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) @@ -66,8 +66,8 @@ class DataHeaderBand : public BandDesignIntf Q_OBJECT Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) - Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) Q_PROPERTY(bool repeatOnEachRow READ repeatOnEachRow WRITE setRepeatOnEachRow) public: DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0); @@ -88,7 +88,7 @@ class DataFooterBand : public BandDesignIntf Q_OBJECT Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) public: DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); diff --git a/limereport/bands/lrgroupbands.cpp b/limereport/bands/lrgroupbands.cpp index 6865ce5..569e0df 100644 --- a/limereport/bands/lrgroupbands.cpp +++ b/limereport/bands/lrgroupbands.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrgroupbands.h b/limereport/bands/lrgroupbands.h index 42285d8..62b9b16 100644 --- a/limereport/bands/lrgroupbands.h +++ b/limereport/bands/lrgroupbands.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrpagefooter.cpp b/limereport/bands/lrpagefooter.cpp index 9793487..0cb7091 100644 --- a/limereport/bands/lrpagefooter.cpp +++ b/limereport/bands/lrpagefooter.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrpagefooter.h b/limereport/bands/lrpagefooter.h index 5c18c7c..ce3ca59 100644 --- a/limereport/bands/lrpagefooter.h +++ b/limereport/bands/lrpagefooter.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrpageheader.cpp b/limereport/bands/lrpageheader.cpp index 26fc9c6..7a08599 100644 --- a/limereport/bands/lrpageheader.cpp +++ b/limereport/bands/lrpageheader.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrpageheader.h b/limereport/bands/lrpageheader.h index b078ae1..ccfdff1 100644 --- a/limereport/bands/lrpageheader.h +++ b/limereport/bands/lrpageheader.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrreportfooter.cpp b/limereport/bands/lrreportfooter.cpp index ead4e60..41c50e0 100644 --- a/limereport/bands/lrreportfooter.cpp +++ b/limereport/bands/lrreportfooter.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrreportfooter.h b/limereport/bands/lrreportfooter.h index 140ad1e..5ffcc0c 100644 --- a/limereport/bands/lrreportfooter.h +++ b/limereport/bands/lrreportfooter.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrreportheader.cpp b/limereport/bands/lrreportheader.cpp index e08f418..af8e924 100644 --- a/limereport/bands/lrreportheader.cpp +++ b/limereport/bands/lrreportheader.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrreportheader.h b/limereport/bands/lrreportheader.h index d532ff9..0faa493 100644 --- a/limereport/bands/lrreportheader.h +++ b/limereport/bands/lrreportheader.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -38,7 +38,7 @@ namespace LimeReport{ class ReportHeader : public LimeReport::BandDesignIntf { Q_OBJECT - Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable ) + Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable) Q_PROPERTY(bool printBeforePageHeader READ printBeforePageHeader WRITE setPrintBeforePageHeader) public: ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0); diff --git a/limereport/bands/lrsubdetailband.cpp b/limereport/bands/lrsubdetailband.cpp index bfdcde3..3e74d7c 100644 --- a/limereport/bands/lrsubdetailband.cpp +++ b/limereport/bands/lrsubdetailband.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index d64eee9..b50b1c2 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -40,7 +40,7 @@ class SubDetailBand : public DataBandDesignIntf Q_OBJECT Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable) Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor) @@ -60,7 +60,7 @@ class SubDetailHeaderBand : public BandDesignIntf { Q_OBJECT Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) public: SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); @@ -78,8 +78,8 @@ class SubDetailFooterBand : public BandDesignIntf Q_OBJECT Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable) - Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) - Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) + Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) + Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways) public: SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0); virtual bool isUnique() const; diff --git a/limereport/base/lrattribsabstractfactory.h b/limereport/base/lrattribsabstractfactory.h index 3499253..4fc7a0f 100644 --- a/limereport/base/lrattribsabstractfactory.h +++ b/limereport/base/lrattribsabstractfactory.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/base/lrsimpleabstractfactory.h b/limereport/base/lrsimpleabstractfactory.h index 3722a8b..3406ee0 100644 --- a/limereport/base/lrsimpleabstractfactory.h +++ b/limereport/base/lrsimpleabstractfactory.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/base/lrsingleton.h b/limereport/base/lrsingleton.h index f011872..87c5255 100644 --- a/limereport/base/lrsingleton.h +++ b/limereport/base/lrsingleton.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrconnectiondialog.cpp b/limereport/databrowser/lrconnectiondialog.cpp index 07c53a5..a4bf8b6 100644 --- a/limereport/databrowser/lrconnectiondialog.cpp +++ b/limereport/databrowser/lrconnectiondialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrconnectiondialog.h b/limereport/databrowser/lrconnectiondialog.h index 12140b1..e9ece7c 100644 --- a/limereport/databrowser/lrconnectiondialog.h +++ b/limereport/databrowser/lrconnectiondialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 32e9995..b91605f 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -63,7 +63,8 @@ DataBrowser::DataBrowser(QWidget *parent) : connect(ui->changeConnection,SIGNAL(clicked()),this,SLOT(slotChangeConnection())); connect(ui->pbConnect,SIGNAL(clicked()),this,SLOT(slotChangeConnectionState())); - ui->verticalLayout_2->setMargin(Const::DOCKWIDGET_MARGINS); + int margin = Const::DOCKWIDGET_MARGINS; + ui->verticalLayout_2->setContentsMargins(margin, margin, margin, margin); ui->dataTree->setHeaderLabel(tr("Datasources")); ui->pbConnect->setEnabled(false); @@ -413,7 +414,7 @@ void DataBrowser::initConnections() connections.append(connectionName); } } - qSort(connections); + std::sort(connections.begin(), connections.end()); foreach (QString connectionName, connections) { QTreeWidgetItem *item=new QTreeWidgetItem( ui->dataTree, @@ -443,7 +444,7 @@ void DataBrowser::initConnections() // } // connections = m_report->dataManager()->connectionNames(); -// qSort(connections); +// std::sort(connections); // foreach(QString connectionName,connectionName){ // if (!QSqlDatabase::contains(connectionName)){ // QTreeWidgetItem *item=new QTreeWidgetItem( diff --git a/limereport/databrowser/lrdatabrowser.h b/limereport/databrowser/lrdatabrowser.h index f0c5144..edab5ef 100644 --- a/limereport/databrowser/lrdatabrowser.h +++ b/limereport/databrowser/lrdatabrowser.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrdatabrowsertree.cpp b/limereport/databrowser/lrdatabrowsertree.cpp index 9128bf4..2625602 100644 --- a/limereport/databrowser/lrdatabrowsertree.cpp +++ b/limereport/databrowser/lrdatabrowsertree.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrdatabrowsertree.h b/limereport/databrowser/lrdatabrowsertree.h index 0614cdc..3cbcdff 100644 --- a/limereport/databrowser/lrdatabrowsertree.h +++ b/limereport/databrowser/lrdatabrowsertree.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrsqleditdialog.cpp b/limereport/databrowser/lrsqleditdialog.cpp index 8f613b5..7fe874f 100644 --- a/limereport/databrowser/lrsqleditdialog.cpp +++ b/limereport/databrowser/lrsqleditdialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrsqleditdialog.h b/limereport/databrowser/lrsqleditdialog.h index 28dcffd..8f3e29a 100644 --- a/limereport/databrowser/lrsqleditdialog.h +++ b/limereport/databrowser/lrsqleditdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/databrowser/lrvariabledialog.cpp b/limereport/databrowser/lrvariabledialog.cpp index 7c5b1a0..cb8f2d0 100644 --- a/limereport/databrowser/lrvariabledialog.cpp +++ b/limereport/databrowser/lrvariabledialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -78,11 +78,10 @@ void LRVariableDialog::showEvent(QShowEvent *) QMetaEnum enumerator = LimeReport::Enums::staticMetaObject.enumerator(enumIndex); if (!m_variableName.isEmpty()&&m_variablesContainer&&m_variablesContainer->containsVariable(m_variableName)){ ui->leValue->setPlainText(m_variablesContainer->variable(m_variableName).toString()); -#ifdef HAVE_QT5 - ui->cbbType->setCurrentText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName))); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->cbbType->setCurrentIndex(ui->cbbType->findText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName)))); +#else + ui->cbbType->setCurrentText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName))); #endif ui->cbbMandatory->setChecked(m_variablesContainer->variableIsMandatory(m_variableName)); } diff --git a/limereport/databrowser/lrvariabledialog.h b/limereport/databrowser/lrvariabledialog.h index 49ba046..61211a7 100644 --- a/limereport/databrowser/lrvariabledialog.h +++ b/limereport/databrowser/lrvariabledialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/designer.pri b/limereport/designer.pri index 72bd275..13bf6ea 100644 --- a/limereport/designer.pri +++ b/limereport/designer.pri @@ -1,8 +1,9 @@ include(../common.pri) -DEFINES+=HAVE_REPORT_DESIGNER -contains(CONFIG,dialogdesigner){ - include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) +DEFINES += HAVE_REPORT_DESIGNER + +CONFIG(dialogdesigner) { + include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) } INCLUDEPATH += $$REPORT_PATH/objectinspector \ @@ -51,7 +52,7 @@ SOURCES += \ $$REPORT_PATH/lrreportdesignwidget.cpp \ $$REPORT_PATH/lrreportdesignwindow.cpp -contains(CONFIG, svg){ +CONFIG(svg) { SOURCES += \ $$REPORT_PATH/objectinspector/editors/lrsvgeditor.cpp \ $$REPORT_PATH/objectinspector/propertyItems/lrsvgpropitem.cpp @@ -100,7 +101,7 @@ HEADERS += \ $$REPORT_PATH/lrreportdesignwidget.h \ $$REPORT_PATH/lrreportdesignwindow.h -contains(CONFIG, svg){ +contains(CONFIG, svg) { HEADERS += \ $$REPORT_PATH/objectinspector/editors/lrsvgeditor.h \ $$REPORT_PATH/objectinspector/propertyItems/lrsvgpropitem.h diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri index f3a02f6..e86cac8 100644 --- a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri @@ -1,11 +1,11 @@ INCLUDEPATH *= $$PWD $$PWD/.. SOURCES += $$PWD/widgethost.cpp \ - $$PWD/sizehandlerect.cpp \ - $$PWD/formresizer.cpp + $$PWD/sizehandlerect.cpp \ + $$PWD/formresizer.cpp HEADERS += $$PWD/widgethost.h \ - $$PWD/sizehandlerect.h \ - $$PWD/formresizer.h \ - $$PWD/widgethostconstants.h \ - $$PWD/../namespace_global.h + $$PWD/sizehandlerect.h \ + $$PWD/formresizer.h \ + $$PWD/widgethostconstants.h \ + $$PWD/../namespace_global.h diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp index e0d88ed..f3bbf48 100644 --- a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp @@ -55,12 +55,13 @@ FormResizer::FormResizer(QWidget *parent) : setBackgroundRole(QPalette::Base); QVBoxLayout *handleLayout = new QVBoxLayout(this); - handleLayout->setMargin(SELECTION_MARGIN); + int margin = SELECTION_MARGIN; + handleLayout->setContentsMargins(margin, margin, margin, margin); handleLayout->addWidget(m_frame); m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised); QVBoxLayout *layout = new QVBoxLayout(m_frame); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); // handles m_handles.reserve(SizeHandleRect::Left); for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) { diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp index b78eb4b..859993e 100644 --- a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp @@ -70,7 +70,7 @@ void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw) setBackgroundRole(QPalette::Base); m_formWindow->setAutoFillBackground(true); - m_formWindow->setBackgroundRole(QPalette::Background); + m_formWindow->setBackgroundRole(QPalette::Window); connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)), this, SLOT(fwSizeWasChanged(QRect, QRect))); diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index 960b7c3..1ad5ba0 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -1,27 +1,27 @@ include(../../common.pri) include($$PWD/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri) + INCLUDEPATH *= $$PWD/3rdparty/designer -greaterThan(QT_MAJOR_VERSION, 4) { - contains(QT,uitools){ - DEFINES += HAVE_QTDESIGNER_INTEGRATION - } -} -lessThan(QT_MAJOR_VERSION, 5){ - contains(CONFIG,uitools){ - DEFINES += HAVE_QTDESIGNER_INTEGRATION - } + +equals(QT_MAJOR_VERSION, 4) : CONFIG(uitools) { + DEFINES += HAVE_QTDESIGNER_INTEGRATION } -greaterThan(QT_MAJOR_VERSION, 4) { +if(equals(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 6)) : contains(QT, uitools) { + DEFINES += HAVE_QTDESIGNER_INTEGRATION +} + +equals(QT_MAJOR_VERSION, 4) { + CONFIG *= designer + qtAddLibrary(QtDesignerComponents) +} + +equals(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 6) { QT *= designer designercomponents-private - -} else { - CONFIG *= designer - qtAddLibrary( QtDesignerComponents ) } SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h RESOURCES += \ - $$PWD/dialogdesigner.qrc + $$PWD/dialogdesigner.qrc diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index 4a23d4d..740b6a6 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -104,10 +104,9 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent) m_designerToolWindows.append(m_actionEditor); connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this); -#endif -#ifdef HAVE_QT5 +#else m_designerIntegration = new QDesignerIntegration(m_formEditor,this); #endif m_formEditor->setIntegration(m_designerIntegration); diff --git a/limereport/items/charts/lrhorizontalbarchart.cpp b/limereport/items/charts/lrhorizontalbarchart.cpp index 3d539d9..e5e0e45 100644 --- a/limereport/items/charts/lrhorizontalbarchart.cpp +++ b/limereport/items/charts/lrhorizontalbarchart.cpp @@ -36,7 +36,7 @@ void HorizontalBarChart::paintHorizontalBars(QPainter *painter, QRectF barsRect) delta = genNextValue(delta); qreal vStep = (barsRect.height()-painter->fontMetrics().height()) / valuesCount() / seriesCount(); - qreal hStep = (barsRect.width()-painter->fontMetrics().width(QString::number(maxValue()))) / delta; + qreal hStep = (barsRect.width()-painter->fontMetrics().boundingRect(QString::number(maxValue())).width()) / delta; if (!m_chartItem->series().isEmpty() && (m_chartItem->itemMode() != DesignMode)){ int curSeries = 0; diff --git a/limereport/items/charts/lrpiechart.cpp b/limereport/items/charts/lrpiechart.cpp index d6afb0c..5932c9e 100644 --- a/limereport/items/charts/lrpiechart.cpp +++ b/limereport/items/charts/lrpiechart.cpp @@ -8,13 +8,12 @@ void PieChart::drawPercent(QPainter *painter, QRectF chartRect, qreal startAngle QPointF center(chartRect.left()+chartRect.width()/2,chartRect.top()+chartRect.height()/2); qreal percent = angle/3.6; -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 qreal radAngle = (angle/2+startAngle)*(M_PI/180); -#endif -#ifdef HAVE_QT5 +#else qreal radAngle = qDegreesToRadians(angle/2+startAngle); #endif - qreal radius = painter->fontMetrics().width("99,9%"); + qreal radius = painter->fontMetrics().boundingRect("99,9%").width(); qreal border = chartRect.height()*0.02; qreal length = (chartRect.height())/2-(radius/2+border); qreal x,y; @@ -155,14 +154,14 @@ QSizeF PieChart::calcChartLegendSize(const QFont &font) SeriesItem* si = m_chartItem->series().at(0); foreach(QString label, si->data()->labels()){ cw += fm.height(); - if (maxWidthsetBorders(0); + m_reportEditor->setBorders({}); ItemsBordersEditorWidget::noBordesClicked(); } diff --git a/limereport/items/editors/lritemsborderseditorwidget.h b/limereport/items/editors/lritemsborderseditorwidget.h index 998251c..233e5f5 100644 --- a/limereport/items/editors/lritemsborderseditorwidget.h +++ b/limereport/items/editors/lritemsborderseditorwidget.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/editors/lrtextalignmenteditorwidget.cpp b/limereport/items/editors/lrtextalignmenteditorwidget.cpp index 8874d13..2569555 100644 --- a/limereport/items/editors/lrtextalignmenteditorwidget.cpp +++ b/limereport/items/editors/lrtextalignmenteditorwidget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -108,7 +108,7 @@ void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align) Qt::Alignment TextAlignmentEditorWidget::createAlignment() { - Qt::Alignment align = 0 ; + Qt::Alignment align = Qt::Alignment(); if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft; if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter; if (m_textAliginRight->isChecked()) align |= Qt::AlignRight; diff --git a/limereport/items/editors/lrtextalignmenteditorwidget.h b/limereport/items/editors/lrtextalignmenteditorwidget.h index 4590be3..958f25a 100644 --- a/limereport/items/editors/lrtextalignmenteditorwidget.h +++ b/limereport/items/editors/lrtextalignmenteditorwidget.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrabstractlayout.h b/limereport/items/lrabstractlayout.h index 14ec715..fcda489 100644 --- a/limereport/items/lrabstractlayout.h +++ b/limereport/items/lrabstractlayout.h @@ -13,7 +13,7 @@ class AbstractLayout: public LayoutDesignIntf Q_PROPERTY(int layoutSpacing READ layoutSpacing WRITE setLayoutSpacing) public: enum LayoutType{Layout,Table}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(LayoutType) #else Q_ENUMS(LayoutType) diff --git a/limereport/items/lralignpropitem.cpp b/limereport/items/lralignpropitem.cpp index 1321b4f..5edb725 100644 --- a/limereport/items/lralignpropitem.cpp +++ b/limereport/items/lralignpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lralignpropitem.h b/limereport/items/lralignpropitem.h index 61e4b7f..0dae738 100644 --- a/limereport/items/lralignpropitem.h +++ b/limereport/items/lralignpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrbarcodeitem.cpp b/limereport/items/lrbarcodeitem.cpp index bbdcfee..78a242c 100644 --- a/limereport/items/lrbarcodeitem.cpp +++ b/limereport/items/lrbarcodeitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrbarcodeitem.h b/limereport/items/lrbarcodeitem.h index c09fbe9..b156c14 100644 --- a/limereport/items/lrbarcodeitem.h +++ b/limereport/items/lrbarcodeitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -37,7 +37,7 @@ namespace LimeReport{ class BarcodeItem : public LimeReport::ContentItemDesignIntf { Q_OBJECT Q_PROPERTY(QString content READ content WRITE setContent) - Q_PROPERTY(BarcodeType barcodeType READ barcodeType WRITE setBarcodeType ) + Q_PROPERTY(BarcodeType barcodeType READ barcodeType WRITE setBarcodeType) Q_PROPERTY(QString datasource READ datasource WRITE setDatasource) Q_PROPERTY(QString field READ field WRITE setField) Q_PROPERTY(QString testValue READ designTestValue WRITE setDesignTestValue) @@ -152,7 +152,7 @@ public: KANJI_INPUT_MODE = 3, SJIS_INPUT_MODE = 4 }; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(BarcodeType) Q_ENUM(AngleType) Q_ENUM(InputMode) diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index 15f76fa..a0f6488 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -30,9 +30,9 @@ namespace LimeReport{ QColor generateColor() { - int red = (qrand()%(256 - 1)) + 1; - int green = (qrand()%(256 - 1)) + 1; - int blue = (qrand()%(256 - 1)) + 1;; + int red = (rand()%(256 - 1)) + 1; + int green = (rand()%(256 - 1)) + 1; + int blue = (rand()%(256 - 1)) + 1;; return QColor(red,green,blue); } @@ -348,7 +348,7 @@ void ChartItem::paintChartTitle(QPainter *painter, QRectF titleRect) painter->save(); QFont tmpFont = painter->font(); QFontMetrics fm(tmpFont); - while ((fm.height()>titleRect.height() || fm.width(m_title)>titleRect.width()) + while ((fm.height()>titleRect.height() || fm.boundingRect(m_title).width()>titleRect.width()) && tmpFont.pixelSize()>1) { tmpFont.setPixelSize(tmpFont.pixelSize()-1); fm = QFontMetrics(tmpFont); @@ -570,14 +570,14 @@ QSizeF AbstractSeriesChart::calcChartLegendSize(const QFont &font) if (!m_chartItem->series().isEmpty()){ foreach(SeriesItem* series, m_chartItem->series()){ cw += fm.height(); - if (maxWidthname())) - maxWidth = fm.width(series->name())+10; + if (maxWidthname()).width()) + maxWidth = fm.boundingRect(series->name()).width()+10; } } else { foreach(QString label, m_designLabels){ cw += fm.height(); - if (maxWidthfontMetrics(); foreach(QString label, m_chartItem->labels()){ - if (fm.width(label) > hStep){ + if (fm.boundingRect(label).width() > hStep){ return true; } } @@ -656,7 +656,7 @@ void AbstractSeriesChart::paintHorizontalGrid(QPainter *painter, QRectF gridRect delta = genNextValue(delta); painter->setRenderHint(QPainter::Antialiasing,false); - qreal hStep = (gridRect.width() - painter->fontMetrics().width(QString::number(maxValue()))) / 4; + qreal hStep = (gridRect.width() - painter->fontMetrics().boundingRect(QString::number(maxValue())).width()) / 4; painter->setFont(adaptValuesFont(hStep-4, painter->font())); @@ -708,7 +708,7 @@ qreal AbstractSeriesChart::valuesHMargin(QPainter *painter) { int delta = int(maxValue()-minValue()); delta = genNextValue(delta); - return painter->fontMetrics().width(QString::number(delta))+4; + return painter->fontMetrics().boundingRect(QString::number(delta)).width()+4; } qreal AbstractSeriesChart::valuesVMargin(QPainter *painter) @@ -722,17 +722,21 @@ QFont AbstractSeriesChart::adaptLabelsFont(QRectF rect, QFont font) QFontMetrics fm(font); foreach(QString label, m_chartItem->labels()){ +#if QT_VERSION < 0x060000 foreach (QString currentWord, label.split(QRegExp("\\W+"))){ - if (fm.width(maxWord) < fm.width(currentWord)) maxWord = currentWord; +#else + foreach (QString currentWord, label.split(QRegularExpression("\\W+"))){ +#endif + if (fm.boundingRect(maxWord).width() < fm.boundingRect(currentWord).width()) maxWord = currentWord; } } - qreal curWidth = fm.width(maxWord); + qreal curWidth = fm.boundingRect(maxWord).width(); QFont tmpFont = font; while (curWidth>rect.width() && tmpFont.pixelSize() > 1){ tmpFont.setPixelSize(tmpFont.pixelSize() - 1); QFontMetricsF tmpFM(tmpFont); - curWidth = tmpFM.width(maxWord); + curWidth = tmpFM.boundingRect(maxWord).width(); } return tmpFont; } @@ -742,11 +746,11 @@ QFont AbstractSeriesChart::adaptValuesFont(qreal width, QFont font) QString strValue = QString::number(maxValue()); QFont tmpFont = font; QScopedPointer fm(new QFontMetricsF(tmpFont)); - qreal curWidth = fm->width(strValue); + qreal curWidth = fm->boundingRect(strValue).width(); while (curWidth > width && tmpFont.pixelSize() > 1){ tmpFont.setPixelSize(tmpFont.pixelSize() - 1); fm.reset(new QFontMetricsF(tmpFont)); - curWidth = fm->width(strValue); + curWidth = fm->boundingRect(strValue).width(); } return tmpFont; } @@ -803,8 +807,8 @@ QRectF AbstractBarChart::verticalLabelsRect(QPainter *painter, QRectF labelsRect qreal maxWidth = 0; foreach (QString label, m_chartItem->labels()) { - if (painter->fontMetrics().width(label)>maxWidth) - maxWidth = painter->fontMetrics().width(label); + if (painter->fontMetrics().boundingRect(label).width()>maxWidth) + maxWidth = painter->fontMetrics().boundingRect(label).width(); } if (maxWidth + hPadding(m_chartItem->rect()) * 2 < labelsRect.width()) @@ -818,8 +822,8 @@ QRectF AbstractBarChart::horizontalLabelsRect(QPainter *painter, QRectF labelsRe qreal maxWidth = 0; foreach (QString label, m_chartItem->labels()) { - if (painter->fontMetrics().width(label)>maxWidth) - maxWidth = painter->fontMetrics().width(label); + if (painter->fontMetrics().boundingRect(label).width()>maxWidth) + maxWidth = painter->fontMetrics().boundingRect(label).width(); } if ((maxWidth + vPadding(m_chartItem->rect()) < labelsRect.height()) || !verticalLabels(painter, labelsRect)) diff --git a/limereport/items/lrchartitem.h b/limereport/items/lrchartitem.h index 3db73ca..cfc283e 100644 --- a/limereport/items/lrchartitem.h +++ b/limereport/items/lrchartitem.h @@ -27,13 +27,13 @@ private: class SeriesItem : public QObject{ Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QString valuesColumn READ valuesColumn WRITE setValuesColumn ) - Q_PROPERTY(QString labelsColumn READ labelsColumn WRITE setLabelsColumn ) + Q_PROPERTY(QString valuesColumn READ valuesColumn WRITE setValuesColumn) + Q_PROPERTY(QString labelsColumn READ labelsColumn WRITE setLabelsColumn) Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(SeriesItemPreferredType preferredType READ preferredType WRITE setPreferredType) public: enum SeriesItemPreferredType {Bar, Line}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(SeriesItemPreferredType) #else Q_ENUMS(SeriesItemPreferredType) @@ -135,7 +135,7 @@ public: enum LegendAlign{LegendAlignTop,LegendAlignCenter,LegendAlignBottom}; enum TitleAlign{TitleAlignLeft, TitleAlignCenter, TitleAlignRight}; enum ChartType{Pie, VerticalBar, HorizontalBar, Lines}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(LegendAlign) Q_ENUM(TitleAlign) Q_ENUM(ChartType) diff --git a/limereport/items/lrchartitemeditor.cpp b/limereport/items/lrchartitemeditor.cpp index 92ea3fb..31a84ec 100644 --- a/limereport/items/lrchartitemeditor.cpp +++ b/limereport/items/lrchartitemeditor.cpp @@ -10,7 +10,7 @@ ChartItemEditor::ChartItemEditor(LimeReport::ChartItem *item, LimeReport::PageDe { ui->setupUi(this); QHBoxLayout* colorLayout = new QHBoxLayout(); - colorLayout->setMargin(0); + colorLayout->setContentsMargins(0, 0, 0, 0); m_colorButton = new QToolButton(); m_colorButton->setText("..."); m_colorButton->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); @@ -118,11 +118,10 @@ void ChartItemEditor::init() ui->seriesTypeComboBox->addItem(enumerator.key(i)); } -#ifdef HAVE_QT5 - ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField()); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->labelsFieldComboBox->setCurrentIndex(ui->labelsFieldComboBox->findText( m_charItem->labelsField())); +#else + ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField()); #endif if (!m_charItem->series().isEmpty()){ enableSeriesEditor(); @@ -150,11 +149,10 @@ void ChartItemEditor::disableSeriesEditor() ui->valuesFieldComboBox->setDisabled(true); m_colorButton->setDisabled(true); m_colorIndicator->setDisabled(true); -#ifdef HAVE_QT5 - ui->valuesFieldComboBox->setCurrentText(""); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->valuesFieldComboBox->setEditText(""); +#else + ui->valuesFieldComboBox->setCurrentText(""); #endif ui->seriesTypeComboBox->setDisabled(true); } @@ -208,11 +206,10 @@ void ChartItemEditor::slotAddSeries() ui->tableWidget->setRowCount(m_charItem->series().count()); ui->tableWidget->setItem(m_charItem->series().count()-1, 0, new QTableWidgetItem(series->name())); ui->tableWidget->selectRow(m_charItem->series().count()-1); -#ifdef HAVE_QT5 - ui->valuesFieldComboBox->setCurrentText(""); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->valuesFieldComboBox->setEditText(""); +#else + ui->valuesFieldComboBox->setCurrentText(""); #endif } @@ -235,20 +232,18 @@ void ChartItemEditor::on_tableWidget_itemSelectionChanged() if (ui->tableWidget->selectionModel()->hasSelection()){ LimeReport::SeriesItem* series = m_charItem->series().at(ui->tableWidget->selectionModel()->currentIndex().row()); ui->seriesNameLineEdit->setText(series->name()); -#ifdef HAVE_QT5 - ui->valuesFieldComboBox->setCurrentText(series->valuesColumn()); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->valuesFieldComboBox->setCurrentIndex(ui->valuesFieldComboBox->findText(series->valuesColumn())); +#else + ui->valuesFieldComboBox->setCurrentText(series->valuesColumn()); #endif m_colorIndicator->setColor(series->color()); static int enumIndex = LimeReport::SeriesItem::staticMetaObject.indexOfEnumerator("SeriesItemPreferredType"); QMetaEnum enumerator = LimeReport::SeriesItem::staticMetaObject.enumerator(enumIndex); -#ifdef HAVE_QT5 - ui->seriesTypeComboBox->setCurrentText(enumerator.valueToKey(series->preferredType())); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->seriesTypeComboBox->setCurrentIndex(ui->seriesTypeComboBox->findText(enumerator.valueToKey(series->preferredType()))); +#else + ui->seriesTypeComboBox->setCurrentText(enumerator.valueToKey(series->preferredType())); #endif enableSeriesEditor(); } diff --git a/limereport/items/lrhorizontallayout.cpp b/limereport/items/lrhorizontallayout.cpp index f4f51ef..11a29d9 100644 --- a/limereport/items/lrhorizontallayout.cpp +++ b/limereport/items/lrhorizontallayout.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -140,7 +140,7 @@ void HorizontalLayout::setItemAlign(const BaseDesignIntf::ItemAlign &itemAlign) void HorizontalLayout::sortChildren() { - qSort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen); + std::sort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen); } void HorizontalLayout::updateLayoutSize() @@ -177,7 +177,7 @@ void HorizontalLayout::relocateChildren() layoutsChildren().append(item); } } - qSort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen); + std::sort(layoutsChildren().begin(),layoutsChildren().end(),horizontalLessThen); qreal curX = spaceBorder; setIsRelocating(true); foreach (BaseDesignIntf* item, layoutsChildren()) { diff --git a/limereport/items/lrhorizontallayout.h b/limereport/items/lrhorizontallayout.h index fcd9e93..fa442e2 100644 --- a/limereport/items/lrhorizontallayout.h +++ b/limereport/items/lrhorizontallayout.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index a58531b..02f7daa 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrimageitem.h b/limereport/items/lrimageitem.h index bf36257..5640e8a 100644 --- a/limereport/items/lrimageitem.h +++ b/limereport/items/lrimageitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -58,7 +58,7 @@ public: Hex = 1, Base64 = 2 }; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(Format) #else Q_ENUMS(Format) diff --git a/limereport/items/lrshapeitem.cpp b/limereport/items/lrshapeitem.cpp index 4bef04b..875cb34 100644 --- a/limereport/items/lrshapeitem.cpp +++ b/limereport/items/lrshapeitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrshapeitem.h b/limereport/items/lrshapeitem.h index bdfab3b..b9ba727 100644 --- a/limereport/items/lrshapeitem.h +++ b/limereport/items/lrshapeitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -47,7 +47,7 @@ class ShapeItem: public LimeReport::ItemDesignIntf Q_PROPERTY(int cornerRadius READ cornerRadius WRITE setCornerRadius) public: enum ShapeType{HorizontalLine,VerticalLine,Ellipse,Rectangle}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(ShapeType) #else Q_ENUMS(ShapeType) diff --git a/limereport/items/lrsimpletagparser.cpp b/limereport/items/lrsimpletagparser.cpp index e5c5c3a..2ee4e6a 100644 --- a/limereport/items/lrsimpletagparser.cpp +++ b/limereport/items/lrsimpletagparser.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -28,14 +28,18 @@ * GNU General Public License for more details. * ****************************************************************************/ #include "lrsimpletagparser.h" -#include #include #include - +#if QT_VERSION < 0x060000 +#include +#else +#include +#endif namespace LimeReport{ void HtmlContext::fillTagVector(QString html) { +#if QT_VERSION < 0x060000 QRegExp rx("<[^<]*>"); QString buff=html; int curPos=0; @@ -49,10 +53,20 @@ void HtmlContext::fillTagVector(QString html) } buff=buff.right(buff.length()-rx.matchedLength()); } +#else + QRegularExpression rx("<[^<]*>"); + QString buff=html; + while(buff.contains(rx)){ + QRegularExpressionMatch match = rx.match(buff); + // TODO: Qt6 port + } + +#endif } QString HtmlContext::parseTag(QVector &storage, QString text, int &curPos, bool createTag) { +#if QT_VERSION < 0x060000 QRegExp rx("<[^<]*>"); int pos=rx.indexIn(text); int begPos=pos+curPos; @@ -78,12 +92,16 @@ QString HtmlContext::parseTag(QVector &storage, QString text, int &curPos buff=buff.right(buff.length()-rx.matchedLength()); } } +#else + QRegularExpression rx("<[^<]*>"); + // TODO: Qt6 port +#endif return ""; } void HtmlContext::parseSymbs(QString text) { - +#if QT_VERSION < 0x060000 QRegExp rx("<[^<]*[^/]>"); while (text.contains(rx)){ int pos=rx.indexIn(text); @@ -100,6 +118,10 @@ void HtmlContext::parseSymbs(QString text) text.replace(rx.cap(0)," "); } } +#else + QRegularExpression rx("<[^<]*>"); + // TODO: Qt6 port +#endif } void HtmlContext::initSymbPatterns() diff --git a/limereport/items/lrsimpletagparser.h b/limereport/items/lrsimpletagparser.h index 6463edc..ea7603c 100644 --- a/limereport/items/lrsimpletagparser.h +++ b/limereport/items/lrsimpletagparser.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrsubitemparentpropitem.cpp b/limereport/items/lrsubitemparentpropitem.cpp index 61ff802..cfb8504 100644 --- a/limereport/items/lrsubitemparentpropitem.cpp +++ b/limereport/items/lrsubitemparentpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrsubitemparentpropitem.h b/limereport/items/lrsubitemparentpropitem.h index 9aa420e..3733c75 100644 --- a/limereport/items/lrsubitemparentpropitem.h +++ b/limereport/items/lrsubitemparentpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 50de9d5..0effd5d 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -360,7 +360,11 @@ void TextItem::updateLayout() bool TextItem::isNeedExpandContent() const { +#if QT_VERSION < 0x060000 QRegExp rx("$*\\{[^{]*\\}"); +#else + QRegularExpression rx("$*\\{[^{]*\\}"); +#endif return content().contains(rx) || isContentBackedUp(); } @@ -448,7 +452,11 @@ QString TextItem::formatNumber(const double value) if (m_format.contains("%")) { +#if QT_VERSION < 0x050500 str.sprintf(m_format.toStdString().c_str(), value); +#else + str.asprintf(m_format.toStdString().c_str(), value); +#endif str = str.replace(",", QLocale::system().groupSeparator()); str = str.replace(".", QLocale::system().decimalPoint()); } @@ -813,7 +821,11 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) { QString context=content(); foreach (QString variableName, dataManager->variableNamesByRenderPass(SecondPass)) { +#if QT_VERSION < 0x060000 QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); +#else + QRegularExpression rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); +#endif if (context.contains(rx) && pass == FirstPass){ backupContent(); break; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index fbd2bfd..0d63415 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -46,10 +46,10 @@ class TextItem : public ContentItemDesignIntf, IPageInit { Q_OBJECT Q_PROPERTY(QString content READ content WRITE setContent) Q_PROPERTY(int margin READ marginSize WRITE setMarginSize) - Q_PROPERTY(Qt::Alignment alignment READ alignment() WRITE setAlignment) - Q_PROPERTY(AutoWidth autoWidth READ autoWidth() WRITE setAutoWidth) - Q_PROPERTY(bool autoHeight READ autoHeight() WRITE setAutoHeight) - Q_PROPERTY(QFont font READ font() WRITE setTextItemFont) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) + Q_PROPERTY(AutoWidth autoWidth READ autoWidth WRITE setAutoWidth) + Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight) + Q_PROPERTY(QFont font READ font WRITE setTextItemFont) Q_PROPERTY(int backgroundOpacity READ opacity WRITE setBackgroundOpacity) Q_PROPERTY(BGMode backgroundMode READ backgroundMode WRITE setBackgroundModeProperty) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColorProperty) @@ -79,7 +79,7 @@ public: enum AutoWidth{NoneAutoWidth, MaxWordLength, MaxStringLength}; enum AngleType{Angle0, Angle90, Angle180, Angle270, Angle45, Angle315}; enum ValueType{Default, DateTime, Double}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(AutoWidth) Q_ENUM(AngleType) Q_ENUM(ValueType) diff --git a/limereport/items/lrtextitemeditor.cpp b/limereport/items/lrtextitemeditor.cpp index 8299fbc..e8c5770 100644 --- a/limereport/items/lrtextitemeditor.cpp +++ b/limereport/items/lrtextitemeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrtextitemeditor.h b/limereport/items/lrtextitemeditor.h index b9e2750..b2c97ef 100644 --- a/limereport/items/lrtextitemeditor.h +++ b/limereport/items/lrtextitemeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/items/lrverticallayout.cpp b/limereport/items/lrverticallayout.cpp index 5550896..1b1971e 100644 --- a/limereport/items/lrverticallayout.cpp +++ b/limereport/items/lrverticallayout.cpp @@ -63,7 +63,7 @@ void VerticalLayout::relocateChildren() layoutsChildren().append(item); } } - qSort(layoutsChildren().begin(),layoutsChildren().end(), verticalLessThen); + std::sort(layoutsChildren().begin(),layoutsChildren().end(), verticalLessThen); qreal curY = spaceBorder; setIsRelocating(true); foreach (BaseDesignIntf* item, layoutsChildren()) { @@ -140,7 +140,7 @@ BaseDesignIntf* VerticalLayout::cloneBottomPart(int height, QObject* owner, QGra void VerticalLayout::sortChildren() { - qSort(layoutsChildren().begin(),layoutsChildren().end(),verticalLessThen); + std::sort(layoutsChildren().begin(),layoutsChildren().end(),verticalLessThen); } void VerticalLayout::divideSpace() diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 7ac6522..404f654 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -84,15 +84,15 @@ SOURCES += \ $$REPORT_PATH/exporters/lrpdfexporter.cpp \ $$REPORT_PATH/lrpreparedpages.cpp -contains(CONFIG, staticlib){ +CONFIG(staticlib) { SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp } -contains(CONFIG, zint){ +CONFIG(zint) { SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp } -contains(CONFIG, svg){ +CONFIG(svg){ SOURCES += $$REPORT_PATH/items/lrsvgitem.cpp \ } @@ -187,15 +187,15 @@ HEADERS += \ $$REPORT_PATH/lrpreparedpages.h \ $$REPORT_PATH/lrpreparedpagesintf.h -contains(CONFIG, staticlib){ +CONFIG(staticlib) { HEADERS += $$REPORT_PATH/lrfactoryinitializer.h } -contains(CONFIG,zint){ +CONFIG(zint) { HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h } -contains(CONFIG, svg){ +CONFIG(svg) { HEADERS += $$REPORT_PATH/items/lrsvgitem.h } @@ -219,4 +219,3 @@ FORMS += \ RESOURCES += \ $$REPORT_PATH/report.qrc \ $$REPORT_PATH/items/items.qrc - diff --git a/limereport/limereport.pro b/limereport/limereport.pro index 7c7e566..333b16d 100644 --- a/limereport/limereport.pro +++ b/limereport/limereport.pro @@ -1,4 +1,4 @@ -CONFIG(debug, debug|release){ +CONFIG(debug, debug|release) { TARGET = limereportd } else { TARGET = limereport @@ -6,11 +6,11 @@ CONFIG(debug, debug|release){ TEMPLATE = lib -contains(CONFIG, static_build){ +CONFIG(static_build) { CONFIG += staticlib } -!contains(CONFIG, staticlib){ +!CONFIG(staticlib) { CONFIG += lib CONFIG += dll } @@ -19,14 +19,14 @@ CONFIG += create_prl CONFIG += link_prl macx{ - CONFIG -= dll - CONFIG += lib_bundle - CONFIG += plugin + CONFIG -= dll + CONFIG += lib_bundle + CONFIG += plugin } DEFINES += LIMEREPORT_EXPORTS -contains(CONFIG, staticlib){ +CONFIG(staticlib) { DEFINES += HAVE_STATIC_BUILD DEFINES += QZINT_STATIC_BUILD message(STATIC_BUILD) @@ -42,19 +42,20 @@ EXTRA_FILES += \ $$PWD/lrcallbackdatasourceintf.h \ $$PWD/lrpreviewreportwidget.h \ $$PWD/lrreportdesignwindowintrerface.h + $$PWD/lrpreparedpagesintf.h include(limereport.pri) unix:{ - DESTDIR = $${DEST_LIBS} + DESTDIR = $${DEST_LIBS} linux{ QMAKE_POST_LINK += mkdir -p \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) # qmake need make mkdir -p on subdirs more than root/ - for(FILE,EXTRA_FILES){ + for(FILE,EXTRA_FILES) { QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) # inside of libs make /include/files } } macx{ - for(FILE,EXTRA_FILES){ + for(FILE,EXTRA_FILES) { QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) } QMAKE_POST_LINK += mkdir -p \"$${DESTDIR}/include\" $$escape_expand(\\n\\t) @@ -64,9 +65,9 @@ unix:{ win32 { DESTDIR = $${DEST_LIBS} - contains(QMAKE_HOST.os, Linux){ + contains(QMAKE_HOST.os, Linux) { QMAKE_POST_LINK += mkdir -p \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) # qmake need make mkdir -p on subdirs more than root/ - for(FILE,EXTRA_FILES){ + for(FILE,EXTRA_FILES) { QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) # inside of libs make /include/files } QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$${DEST_INCLUDE_DIR}\" \"$${DESTDIR}\" @@ -77,23 +78,23 @@ win32 { DEST_DIR ~= s,/,\\,g DEST_INCLUDE_DIR ~= s,/,\\,g - for(FILE,EXTRA_FILES){ + for(FILE,EXTRA_FILES) { QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) } QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$${DEST_INCLUDE_DIR}\" \"$${DEST_DIR}\" } } -contains(CONFIG,zint){ +CONFIG(zint) { message(zint) INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt - LIBS += -L$${DEST_LIBS} - CONFIG(release, debug|release){ - LIBS += -lQtZint - } else { - LIBS += -lQtZintd - } + LIBS += -L$${DEST_LIBS} + CONFIG(release, debug|release) { + LIBS += -lQtZint + } else { + LIBS += -lQtZintd + } } #### Install mkspecs, headers and libs to QT_INSTALL_DIR @@ -111,8 +112,8 @@ INSTALLS += target ####Automatically build required translation files (*.qm) -contains(CONFIG,build_translations){ - LANGUAGES = ru es_ES ar fr zh +CONFIG(build_translations) { + LANGUAGES = ru es ar fr zh pl defineReplace(prependAll) { for(a,$$1):result += $$2$${a}$$3 @@ -138,5 +139,3 @@ contains(CONFIG,build_translations){ } #### EN AUTOMATIC TRANSLATIONS - - diff --git a/limereport/lraboutdialog.cpp b/limereport/lraboutdialog.cpp index 3228cfc..57cddd6 100644 --- a/limereport/lraboutdialog.cpp +++ b/limereport/lraboutdialog.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -27,6 +27,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * ****************************************************************************/ +#ifdef CMAKE_CONFIG +#include +#endif #include "lraboutdialog.h" #include "ui_lraboutdialog.h" diff --git a/limereport/lraboutdialog.h b/limereport/lraboutdialog.h index 62c2ff9..c823be0 100644 --- a/limereport/lraboutdialog.h +++ b/limereport/lraboutdialog.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lraboutdialog.ui b/limereport/lraboutdialog.ui index dea24a2..89ed655 100644 --- a/limereport/lraboutdialog.ui +++ b/limereport/lraboutdialog.ui @@ -42,7 +42,7 @@ p, li { white-space: pre-wrap; } <p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;"><br /></p> <p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600;">This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span></p> <p align="justify" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;"><br /></p> -<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2015 Arin Alexander. All rights reserved.</span></p></body></html> +<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Copyright 2021 Arin Alexander. All rights reserved.</span></p></body></html> diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 6bd6af8..fe7a5a6 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -266,7 +266,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op QFontMetrics fontMetrics(font); QVector bandNameRects; - bandNameRects.push_back(QRectF(8,8,fontMetrics.width(" "+bandText+" "),fontMetrics.height())); + bandNameRects.push_back(QRectF(8,8,fontMetrics.boundingRect(" "+bandText+" ").width(),fontMetrics.height())); //bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),2,fontMetrics.width(" "+bandText+" "),fontMetrics.height())); //bandNameRects.push_back(QRectF(2,height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height())); //bandNameRects.push_back(QRectF(width()-fontMetrics.width(" "+bandText+" "),height()-fontMetrics.height(),fontMetrics.width(" "+bandText+" "),fontMetrics.height())); @@ -487,7 +487,7 @@ QList BandDesignIntf::childrenByType(BandDesignIntf::BandsType foreach(BandDesignIntf* item,childBands()){ if (item->bandType()==type) resList<pos().x()+10, m_band->pos().y()-(fontMetrics.height()+10), - fontMetrics.width(bandName)+20,fontMetrics.height()+10 + fontMetrics.boundingRect(bandName).width()+20,fontMetrics.height()+10 ); update(); } diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 59bec04..0def742 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -103,11 +103,11 @@ private: class BandDesignIntf : public ItemsContainerDesignInft { Q_OBJECT - Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight ) - Q_PROPERTY(int bandIndex READ bandIndex WRITE setBandIndex DESIGNABLE false ) - Q_PROPERTY(bool keepBottomSpace READ keepBottomSpace WRITE setKeepBottomSpace ) + Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight) + Q_PROPERTY(int bandIndex READ bandIndex WRITE setBandIndex DESIGNABLE false) + Q_PROPERTY(bool keepBottomSpace READ keepBottomSpace WRITE setKeepBottomSpace) Q_PROPERTY(bool keepTopSpace READ keepTopSpace WRITE setKeepTopSpace) - Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false ) + Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty) @@ -138,7 +138,7 @@ public: enum BandColumnsLayoutType{ Horizontal, Vertical, VerticalUniform }; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(BandColumnsLayoutType) #else Q_ENUMS(BandColumnsLayoutType) @@ -341,7 +341,7 @@ private: class DataBandDesignIntf : public BandDesignIntf{ Q_OBJECT - Q_PROPERTY(QString datasource READ datasourceName WRITE setDataSourceName ) + Q_PROPERTY(QString datasource READ datasourceName WRITE setDataSourceName) public: DataBandDesignIntf(BandsType bandType, QString xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0); }; diff --git a/limereport/lrbandsmanager.cpp b/limereport/lrbandsmanager.cpp index 25ba344..881aa90 100644 --- a/limereport/lrbandsmanager.cpp +++ b/limereport/lrbandsmanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrbandsmanager.h b/limereport/lrbandsmanager.h index 0a850c7..be4646b 100644 --- a/limereport/lrbandsmanager.h +++ b/limereport/lrbandsmanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 9d25dbf..97660f6 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 5e502f7..6a2b3ea 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -144,7 +144,7 @@ public: enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign}; enum UnitType {Millimeters, Inches}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(BGMode) Q_ENUM(BrushStyle) Q_ENUM(ResizeFlags) diff --git a/limereport/lrcollection.h b/limereport/lrcollection.h index 641ddff..4e3aded 100644 --- a/limereport/lrcollection.h +++ b/limereport/lrcollection.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index b16d77d..f970c86 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrdatadesignintf.h b/limereport/lrdatadesignintf.h index 71543cb..f76de85 100644 --- a/limereport/lrdatadesignintf.h +++ b/limereport/lrdatadesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -70,7 +70,7 @@ private: class ConnectionDesc : public QObject{ Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName ) + Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString driver READ driver WRITE setDriver) Q_PROPERTY(QString databaseName READ databaseName WRITE setDatabaseName) Q_PROPERTY(QString userName READ userName WRITE setUserName) @@ -83,7 +83,7 @@ public: typedef QSharedPointer Ptr; ConnectionDesc(QSqlDatabase db, QObject* parent=0); ConnectionDesc(QObject* parent=0); - Ptr create(QSqlDatabase db, QObject* parent=0); + Ptr create(QSqlDatabase db, QObject* parent=0); void setName(const QString &value); QString name(){return m_connectionName;} void setDriver(const QString &value){m_connectionDriver=value;} diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 382a05c..03135ff 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -31,7 +31,9 @@ #include "lrdatadesignintf.h" #include #include +#if QT_VERSION < 0x060000 #include +#endif #include #include #include @@ -421,6 +423,7 @@ QString DataSourceManager::extractField(QString source) } QString DataSourceManager::replaceVariables(QString value){ +#if QT_VERSION < 0x060000 QRegExp rx(Const::VARIABLE_RX); if (value.contains(rx)){ @@ -438,10 +441,16 @@ QString DataSourceManager::replaceVariables(QString value){ } } return value; +#else + QRegularExpression rx(Const::VARIABLE_RX); + // TODO: Qt6 port +#endif + return QString(); } QString DataSourceManager::replaceVariables(QString query, QMap &aliasesToParam) { +#if QT_VERSION < 0x060000 QRegExp rx(Const::VARIABLE_RX); int curentAliasIndex = 0; if (query.contains(rx)){ @@ -480,10 +489,16 @@ QString DataSourceManager::replaceVariables(QString query, QMap } } return query; +#else + QRegularExpression rx(Const::VARIABLE_RX); + // TODO: Qt6 port +#endif + return QString(); } QString DataSourceManager::replaceFields(QString query, QMap &aliasesToParam, QString masterDatasource) { +#if QT_VERSION < 0x060000 QRegExp rx(Const::FIELD_RX); if (query.contains(rx)){ int curentAliasIndex=0; @@ -510,6 +525,11 @@ QString DataSourceManager::replaceFields(QString query, QMap &a } } return query; +#else + QRegularExpression rx(Const::FIELD_RX); + // TODO: Qt6 port +#endif + return QString(); } void DataSourceManager::setReportVariable(const QString &name, const QVariant &value) @@ -1392,7 +1412,11 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl foreach (const QString& datasourceName, dataSourceNames()){ QueryHolder* holder = dynamic_cast(m_datasources.value(datasourceName)); if (holder){ +#if QT_VERSION < 0x060000 QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); +#else + QRegularExpression rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); +#endif if (holder->queryText().contains(rx)){ holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE); datasources.append(datasourceName); diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index 9c8518f..f870b77 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrdatasourcemanagerintf.h b/limereport/lrdatasourcemanagerintf.h index 040dd1d..c43b239 100644 --- a/limereport/lrdatasourcemanagerintf.h +++ b/limereport/lrdatasourcemanagerintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrdesignelementsfactory.h b/limereport/lrdesignelementsfactory.h index 986c354..e28cfac 100644 --- a/limereport/lrdesignelementsfactory.h +++ b/limereport/lrdesignelementsfactory.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrglobal.cpp b/limereport/lrglobal.cpp index 4d8da61..8df6e22 100644 --- a/limereport/lrglobal.cpp +++ b/limereport/lrglobal.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -67,7 +67,11 @@ QString replaceHTMLSymbols(const QString &value) return result; } +#if QT_VERSION < 0x060000 QVector normalizeCaptures(const QRegExp& reg){ +#else +QVector normalizeCaptures(const QRegularExpressionMatch& reg){ +#endif QVector result; foreach (QString cap, reg.capturedTexts()) { if (!cap.isEmpty()) diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 8a312d8..f1da95f 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -51,7 +51,7 @@ namespace LimeReport { #define VARIABLE_IS_NOT_USED #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) +#if QT_VERSION >= 0x050800 Q_NAMESPACE #endif @@ -104,7 +104,11 @@ namespace Const{ QString extractClassName(QString className); QString escapeSimbols(const QString& value); QString replaceHTMLSymbols(const QString &value); +#if QT_VERSION < 0x060000 QVector normalizeCaptures(const QRegExp ®); +#else + QVector normalizeCaptures(const QRegularExpressionMatch ®); +#endif bool isColorDark(QColor color); enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols}; @@ -148,7 +152,7 @@ namespace Const{ virtual ~IPainterProxy(); }; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if QT_VERSION < 0x050000 typedef QStyleOptionViewItemV4 StyleOptionViewItem; #else typedef QStyleOptionViewItem StyleOptionViewItem; @@ -158,7 +162,7 @@ namespace Const{ { public: enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(VariableDataType) #else Q_ENUMS(VariableDataType) diff --git a/limereport/lrgraphicsviewzoom.cpp b/limereport/lrgraphicsviewzoom.cpp index 89ae87e..ead08cd 100644 --- a/limereport/lrgraphicsviewzoom.cpp +++ b/limereport/lrgraphicsviewzoom.cpp @@ -53,12 +53,21 @@ bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) { } else if (event->type() == QEvent::Wheel) { QWheelEvent* wheel_event = static_cast(event); if (QApplication::keyboardModifiers() == m_modifiers) { + #if QT_VERSION < 0x060000 if (wheel_event->orientation() == Qt::Vertical) { double angle = wheel_event->delta(); double factor = qPow(m_zoomFactorBase, angle); gentleZoom(factor); return true; } +#else + if (wheel_event->angleDelta().y() != 0) { + double angle = wheel_event->angleDelta().y(); + double factor = qPow(m_zoomFactorBase, angle); + gentleZoom(factor); + return true; + } +#endif } } Q_UNUSED(object) diff --git a/limereport/lrgroupfunctions.cpp b/limereport/lrgroupfunctions.cpp index edc516e..30db2d2 100644 --- a/limereport/lrgroupfunctions.cpp +++ b/limereport/lrgroupfunctions.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -34,7 +34,9 @@ #include "lrscriptenginemanager.h" #include "lrpageitemdesignintf.h" +#if QT_VERSION < 0x060000 #include +#endif namespace LimeReport { @@ -42,13 +44,24 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) { ScriptEngineManager& sm = ScriptEngineManager::instance(); +#if QT_VERSION < 0x060000 QRegExp rxField(Const::FIELD_RX); QRegExp rxVar(Const::VARIABLE_RX); +#else + QRegularExpression rxField(Const::FIELD_RX); + QRegularExpression rxVar(Const::VARIABLE_RX); +#endif switch (m_dataType){ - case Field: + case Field:{ +#if QT_VERSION < 0x060000 if (rxField.indexIn(m_data) != -1){ QString field = rxField.cap(1); +#else + QRegularExpressionMatch matchField = rxField.match(m_data); + if(matchField.hasMatch()){ + QString field = matchField.captured(1); +#endif if (m_dataManager->containsField(field)){ m_values.push_back(m_dataManager->fieldData(field)); m_valuesByBand.insert(band, m_dataManager->fieldData(field)); @@ -57,9 +70,16 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) } } break; - case Variable: + } + case Variable:{ +#if QT_VERSION < 0x060000 if (rxVar.indexIn(m_data) != -1){ QString var = rxVar.cap(1); +#else + QRegularExpressionMatch matchVar = rxVar.match(m_data); + if(matchVar.hasMatch()){ + QString var = matchVar.captured(1); +#endif if (m_dataManager->containsVariable(var)){ m_values.push_back(m_dataManager->variable(var)); m_valuesByBand.insert(band, m_dataManager->variable(var)); @@ -68,6 +88,7 @@ void GroupFunction::slotBandRendered(BandDesignIntf *band) } } break; + } case Script: { QVariant value = sm.evaluateScript(m_data); @@ -128,21 +149,41 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2) GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager) :m_data(expression), m_dataBandName(dataBandName), m_dataManager(dataManager), m_isValid(true), m_errorMessage("") { +#if QT_VERSION < 0x060000 QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive); QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive); QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive); - +#else + QRegularExpression rxField(Const::FIELD_RX, QRegularExpression::CaseInsensitiveOption); + QRegularExpression rxVariable(Const::VARIABLE_RX, QRegularExpression::CaseInsensitiveOption); + QRegularExpression rxScript(Const::SCRIPT_RX, QRegularExpression::CaseInsensitiveOption); +#endif +#if QT_VERSION < 0x060000 if (rxScript.indexIn(expression) != -1){ +#else + QRegularExpressionMatch matchScript = rxScript.match(expression); + if(matchScript.hasMatch()){ +#endif m_dataType = Script; return; } +#if QT_VERSION < 0x060000 if (rxField.indexIn(expression) != -1){ +#else + QRegularExpressionMatch matchField = rxField.match(expression); + if(matchField.hasMatch()){ +#endif m_dataType=Field; return; } +#if QT_VERSION < 0x060000 if (rxVariable.indexIn(expression) != -1){ +#else + QRegularExpressionMatch matchVariable = rxVariable.match(expression); + if(matchVariable.hasMatch()){ +#endif m_dataType = Variable; return; } diff --git a/limereport/lrgroupfunctions.h b/limereport/lrgroupfunctions.h index 0c4acba..ed2ffec 100644 --- a/limereport/lrgroupfunctions.h +++ b/limereport/lrgroupfunctions.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lritemdesignintf.cpp b/limereport/lritemdesignintf.cpp index f90a90d..86e029b 100644 --- a/limereport/lritemdesignintf.cpp +++ b/limereport/lritemdesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -35,7 +35,9 @@ #include "lrglobal.h" #include +#if QT_VERSION < 0x060000 #include +#endif #include namespace LimeReport{ diff --git a/limereport/lritemdesignintf.h b/limereport/lritemdesignintf.h index ad95e25..0687651 100644 --- a/limereport/lritemdesignintf.h +++ b/limereport/lritemdesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -43,7 +43,7 @@ class ItemDesignIntf : public BaseDesignIntf Q_PROPERTY(ItemAlign itemAlign READ itemAlign WRITE setItemAlign) public: enum LocationType{Band,Page}; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#if QT_VERSION >= 0x050500 Q_ENUM(LocationType) #else Q_ENUMS(LocationType) diff --git a/limereport/lritemscontainerdesignitf.cpp b/limereport/lritemscontainerdesignitf.cpp index 836fbea..441e069 100644 --- a/limereport/lritemscontainerdesignitf.cpp +++ b/limereport/lritemscontainerdesignitf.cpp @@ -48,7 +48,7 @@ void ItemsContainerDesignInft::snapshotItemsLayout(SnapshotType type) } else m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); } - qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen); + std::sort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen); } void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type) diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index d9c495d..d4db356 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -752,16 +752,28 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event) bool isVar = event->mimeData()->text().indexOf("variable:")==0; BaseDesignIntf* item = addReportItem("TextItem",event->scenePos(),QSize(250, 50)); TextItem* ti = dynamic_cast(item); - QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1); + QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1); +#if QT_VERSION < 0x060000 if (isVar) data = data.remove(QRegExp(" \\[.*\\]")); +#else + if (isVar) data = data.remove(QRegularExpression(" \\[.*\\]")); +#endif ti->setContent(data); if (!isVar){ BandDesignIntf* parentBand = dynamic_cast(ti->parentItem()); if (parentBand && parentBand->datasourceName().isEmpty()){ +#if QT_VERSION < 0x060000 QRegExp dataSource("(?:\\$D\\{\\s*(.*)\\..*\\})"); if (dataSource.indexIn(data) != -1){ parentBand->setProperty("datasource",dataSource.cap(1)); } +#else + QRegularExpression dataSource("(?:\\$D\\{\\s*(.*)\\..*\\})"); + QRegularExpressionMatch match = dataSource.match(data); + if(match.hasMatch()){ + parentBand->setProperty("datasource", match.captured(1)); + } +#endif } } } @@ -1723,7 +1735,7 @@ HorizontalLayout* PageDesignIntf::internalAddHLayout() QList si = selectedItems(); QList::iterator it = si.begin(); - qSort(si.begin(), si.end(), hLayoutLessThen); + std::sort(si.begin(), si.end(), hLayoutLessThen); it = si.begin(); if (si.count() > 1) { @@ -1767,7 +1779,7 @@ VerticalLayout* PageDesignIntf::internalAddVLayout() QList si = selectedItems(); QList::iterator it = si.begin(); - qSort(si.begin(), si.end(), vLayoutLessThen); + std::sort(si.begin(), si.end(), vLayoutLessThen); it = si.begin(); if (si.count() > 1) { @@ -1863,6 +1875,9 @@ void PageDesignIntf::setItemMode(BaseDesignIntf::ItemMode mode) } } } + foreach(PageItemDesignIntf::Ptr page, m_reportPages){ + page->setItemMode(mode); + } } } diff --git a/limereport/lrpagedesignintf.h b/limereport/lrpagedesignintf.h index 91d0a68..4d8fd19 100644 --- a/limereport/lrpagedesignintf.h +++ b/limereport/lrpagedesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -99,7 +99,7 @@ namespace LimeReport { class PageDesignIntf : public QGraphicsScene, public ObjectLoadingStateIntf{ Q_OBJECT - Q_PROPERTY(QObject* pageItem READ pageItem()) + Q_PROPERTY(QObject* pageItem READ pageItem) public: friend class PropertyChangedCommand; friend class InsertHLayoutCommand; diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 850319b..0d57563 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -233,7 +233,7 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe groupFooterIgnoredBands << BandDesignIntf::DataFooter << BandDesignIntf::GroupHeader; int bandIndex = -1; - qSort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex); + std::sort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex); if (bandType != BandDesignIntf::Data){ foreach(BandDesignIntf* band,m_bands){ if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break; @@ -547,7 +547,7 @@ void PageItemDesignIntf::relocateBands() QVector posByColumn; - qSort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex); + std::sort(m_bands.begin(), m_bands.end(), bandSortBandLessThenByIndex); int bandIndex = 0; if (!(itemMode() & DesignMode)){ @@ -623,7 +623,7 @@ int PageItemDesignIntf::dataBandCount() BandDesignIntf *PageItemDesignIntf::dataBandAt(int index) { int count=0; - qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex); + std::sort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex); foreach(BandDesignIntf* band,m_bands){ if (band->bandType()==BandDesignIntf::Data){ if(count==index) return band; @@ -711,10 +711,18 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size) if (size != Custom) { QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); +#if QT_VERSION < 0x060000 printer.setOrientation((QPrinter::Orientation)pageOrientation()); printer.setPaperSize((QPrinter::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); +#endif } else { @@ -829,7 +837,7 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS firstMoveBand->changeBandIndex(firstIndex, true); moveIndex = firstIndex; - qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); + std::sort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); foreach(BandDesignIntf* curBand, bandToMove){ curBand->changeBandIndex(moveIndex,true); @@ -852,7 +860,7 @@ QList PageItemDesignIntf::createBandGroup(int beginIndex, int e if ( curBand->bandIndex() >= beginIndex && curBand->bandIndex() <= endIndex) result.append(curBand); } - qSort(result.begin(), result.end(), bandIndexLessThen); + std::sort(result.begin(), result.end(), bandIndexLessThen); return result; } diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index d297b5f..97d5118 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -66,6 +66,7 @@ class PageItemDesignIntf : public ItemsContainerDesignInft Q_PROPERTY(bool mixWithPriorPage READ mixWithPriorPage WRITE setMixWithPriorPage) friend class ReportRender; public: +#if QT_VERSION < 0x060000 enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape }; enum PrintBehavior {Scale, Split}; @@ -82,7 +83,26 @@ public: Ledger = QPrinter::Ledger, Tabloid = QPrinter::Tabloid, Custom = QPrinter::Custom, NPageSize = Custom }; -#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0)) +#else + enum Orientation { Portrait = QPageLayout::Portrait, Landscape = QPageLayout::Landscape }; + + enum PrintBehavior {Scale, Split}; + + enum PageSize { + A4 = QPageSize::A4, B5 = QPageSize::B5, Letter = QPageSize::Letter, + Legal = QPageSize::Legal, Executive = QPageSize::Executive, + A0 = QPageSize::A0, A1 = QPageSize::A1, A2 = QPageSize::A2, A3 = QPageSize::A3, + A5 = QPageSize::A5, A6 = QPageSize::A6, A7 = QPageSize::A7, A8 = QPageSize::A8, + A9 = QPageSize::A9, B0 = QPageSize::B0, B1 = QPageSize::B1, B10 = QPageSize::B10, + B2 = QPageSize::B2, B3 = QPageSize::B3, B4 = QPageSize::B4, B6 = QPageSize::B6, + B7 = QPageSize::B7, B8 = QPageSize::B8, B9 = QPageSize::B9, C5E = QPageSize::C5E, + Comm10E = QPageSize::Comm10E, DLE = QPageSize::DLE, Folio = QPageSize::Folio, + Ledger = QPageSize::Ledger, Tabloid = QPageSize::Tabloid, Custom = QPageSize::Custom, + NPageSize = Custom + }; +#endif + +#if QT_VERSION >= 0x050500 Q_ENUM(Orientation) Q_ENUM(PrintBehavior) Q_ENUM(PageSize) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 4a8200c..f8d7e20 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -143,7 +143,11 @@ void PreviewReportWidget::initPreview() { if (ui->graphicsView->scene()!=d_ptr->m_previewPage) ui->graphicsView->setScene(d_ptr->m_previewPage); + #if QT_VERSION < 0x060000 ui->graphicsView->resetMatrix(); +#else + ui->graphicsView->resetTransform(); +#endif ui->graphicsView->centerOn(0, 0); ui->graphicsView->scene()->setBackgroundBrush(QColor(m_previewPageBackgroundColor)); setScalePercent(d_ptr->m_scalePercent); @@ -237,15 +241,10 @@ void PreviewReportWidget::print() QPrinter lp(QPrinter::HighResolution); if (!pi.defaultPrinter().isNull()){ -#ifdef HAVE_QT4 - lp.setPrinterName(pi.defaultPrinter().printerName()); -#endif -#ifdef HAVE_QT5 -#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) +#if QT_VERSION >= 0x050300 lp.setPrinterName(pi.defaultPrinterName()); #else lp.setPrinterName(pi.defaultPrinter().printerName()); -#endif #endif } @@ -310,7 +309,11 @@ void PreviewReportWidget::saveToFile() void PreviewReportWidget::setScalePercent(int percent) { m_scaleChanging = true; +#if QT_VERSION < 0x060000 ui->graphicsView->resetMatrix(); +#else + ui->graphicsView->resetTransform(); +#endif d_ptr->m_scalePercent = percent; qreal scaleSize = percent/100.0; ui->graphicsView->scale(scaleSize, scaleSize); @@ -472,7 +475,11 @@ void PreviewReportWidget::reportEngineDestroyed(QObject *object) void PreviewReportWidget::slotZoomed(double ) { +#if QT_VERSION < 0x060000 d_ptr->m_scalePercent = ui->graphicsView->matrix().m11()*100; +#else + d_ptr->m_scalePercent = ui->graphicsView->transform().m11()*100; +#endif emit scalePercentChanged(d_ptr->m_scalePercent); } diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 6517b78..fde07e4 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -41,7 +41,11 @@ #include #include #include +#if QT_VERSION < 0x060000 #include +#else +#include +#endif #include #include #include @@ -57,7 +61,7 @@ PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent, m_progressWidget = new QWidget(ui->statusbar); QHBoxLayout* progressLayout = new QHBoxLayout(); - progressLayout->setMargin(0); + progressLayout->setContentsMargins(0, 0, 0, 0); progressLayout->addWidget(new QLabel(tr("Printing"))); m_progressBar = new QProgressBar(ui->statusbar); m_progressBar->setMaximumWidth(100); @@ -139,11 +143,17 @@ void PreviewReportWindow::restoreSetting() if (v.isValid()){ restoreGeometry(v.toByteArray()); } else { +#if QT_VERSION < 0x060000 QDesktopWidget *desktop = QApplication::desktop(); int screenWidth = desktop->screenGeometry().width(); int screenHeight = desktop->screenGeometry().height(); +#else + QScreen *screen = QGuiApplication::primaryScreen(); + int screenWidth = screen->geometry().width(); + int screenHeight = screen->geometry().height(); +#endif int x = static_cast(screenWidth*0.1); int y = static_cast(screenHeight*0.1); diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index af3a7fe..52cae96 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -60,7 +60,7 @@ class PreviewReportWindow : public QMainWindow { Q_OBJECT public: - explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=0); + explicit PreviewReportWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0, Qt::WindowFlags flags=Qt::WindowFlags()); ~PreviewReportWindow(); void setReportReader(ItemsReaderIntf::Ptr reader); void setPages(ReportPages pages); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index acd6298..b59ca70 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -59,10 +59,9 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivateInterface* report, QSe m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false), m_dialogChanged(false), m_theme("Default"), m_settings(settings), m_defaultUnits(BaseDesignIntf::Millimeters) { -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 m_tabWidget = new LimeReportTabWidget(this); -#endif -#ifdef HAVE_QT5 +#else m_tabWidget = new QTabWidget(this); #endif m_tabWidget->setTabPosition(QTabWidget::South); @@ -147,6 +146,7 @@ QWidget *ReportDesignWidget::toolWindow(ReportDesignWidget::ToolWindowType windo case SignalSlotEditor: return dialogDesignerManager()->signalSlotEditor(); } + return NULL; } #endif @@ -1058,8 +1058,13 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event) if (event->type() == QEvent::Wheel){ QWheelEvent* we = dynamic_cast(event); if (QApplication::keyboardModifiers()==Qt::ControlModifier){ +#if QT_VERSION < 0x060000 if(we->delta()<0) scale(1.2,1.2); else scale(1/1.2,1/1.2); +#else + if(we->pixelDelta().x()<0) scale(1.2,1.2); + else scale(1/1.2,1/1.2); +#endif } } return QWidget::eventFilter(target,event); @@ -1131,10 +1136,10 @@ void Ruler::setPage(PageItemDesignIntf *page) void Ruler::paintEvent(QPaintEvent *event){ QPainter painter(this); - painter.setBrush(palette().background()); + painter.setBrush(palette().window()); painter.setPen(Qt::NoPen); painter.drawRect(event->rect()); -// painter.setPen(palette().foreground().color()); +// painter.setPen(palette().windowText().color()); if (m_page){ qreal rulerWidth = m_page->geometry().width() / m_page->unitFactor(); @@ -1153,13 +1158,13 @@ void Ruler::paintEvent(QPaintEvent *event){ case Horizontal: painter.setPen(Qt::NoPen); - if (isColorDark(palette().background().color())) + if (isColorDark(palette().window().color())) painter.setBrush(QColor("#64893d")); else painter.setBrush(QColor("#b5da91")); drawItemWithChildren(&painter, m_page); - painter.setPen(palette().foreground().color()); + painter.setPen(palette().windowText().color()); for (int i = 0; i < rulerWidth / 10; ++i){ int hs10 = view->mapFromScene(QPointF(m_page->geometry().topLeft().x() + i * 10 * m_page->unitFactor(), 0)).x(); @@ -1172,24 +1177,24 @@ void Ruler::paintEvent(QPaintEvent *event){ painter.drawLine(hs10, 15, hs10, 20); painter.drawLine(hs5, 10, hs5, 20); if ( i > 0) - painter.drawText(QPoint(hs10 - (painter.fontMetrics().width(QString::number(i))/2), 12), + painter.drawText(QPoint(hs10 - (painter.fontMetrics().boundingRect(QString::number(i)).width()/2), 12), QString::number(i)); } } - painter.setPen(palette().foreground().color()); + painter.setPen(palette().windowText().color()); painter.drawLine(m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 0, m_mousePos.x() - (hStartPos > 0 ? hStartPos : 0) , 20); break; case Vertical: painter.setPen(Qt::NoPen); - if (isColorDark(palette().background().color())) + if (isColorDark(palette().window().color())) painter.setBrush(QColor("#64893d")); else painter.setBrush(QColor("#b5da91")); drawItemWithChildren(&painter, m_page); - painter.setPen(palette().foreground().color()); + painter.setPen(palette().windowText().color()); for (int i = 0; i < rulerHeight / 10; ++i){ int vs10 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor())).y(); int vs5 = view->mapFromScene(QPointF(0, m_page->geometry().topLeft().y()+i * 10 * m_page->unitFactor() + 5 * m_page->unitFactor())).y(); @@ -1200,12 +1205,12 @@ void Ruler::paintEvent(QPaintEvent *event){ } painter.drawLine(15, vs10, 20, vs10); if ( i > 0 ) - painter.drawText(QPoint( (15 - painter.fontMetrics().width(QString::number(i))) / 2 , + painter.drawText(QPoint( (15 - painter.fontMetrics().boundingRect(QString::number(i)).width()) / 2 , vs10 + (painter.fontMetrics().height()/2)), QString::number(i)); painter.drawLine(10, vs5, 20, vs5); } } - painter.setPen(palette().foreground().color()); + painter.setPen(palette().windowText().color()); painter.drawLine(0, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0), 20, m_mousePos.y() - (vStartPos > 0 ? vStartPos : 0)); break; diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index ef3b81b..8057f13 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -42,7 +42,7 @@ #include "lrreportengine_p.h" #include "lrgraphicsviewzoom.h" -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 QT_BEGIN_NAMESPACE class LimeReportTabWidget: public QTabWidget{ Q_OBJECT @@ -105,7 +105,7 @@ private: class ReportDesignWidget : public QWidget { Q_OBJECT - Q_PROPERTY(QObject* datasourcesManager READ dataManager()) + Q_PROPERTY(QObject* datasourcesManager READ dataManager) public: enum ToolWindowType{ WidgetBox = 1, @@ -259,10 +259,9 @@ private: DialogDesignerManager* m_dialogDesignerManager; #endif QMainWindow *m_mainWindow; -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 LimeReportTabWidget* m_tabWidget; -#endif -#ifdef HAVE_QT5 +#else QTabWidget* m_tabWidget; #endif GraphicsViewZoomer* m_zoomer; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index bdfa031..cae9df2 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -39,7 +39,11 @@ #include #include #include +#if QT_VERSION < 0x060000 #include +#else +#include +#endif #include #include #include @@ -69,7 +73,7 @@ void ReportDesignWindow::createProgressBar() { m_progressWidget = new QWidget(m_statusBar); QHBoxLayout* progressLayout = new QHBoxLayout(); - progressLayout->setMargin(0); + progressLayout->setContentsMargins(0, 0, 0, 0); m_progressLabel = new QLabel(tr("Rendered %1 pages").arg(0)); progressLayout->addWidget(m_progressLabel); m_progressBar = new QProgressBar(m_statusBar); @@ -149,7 +153,7 @@ void ReportDesignWindow::createActions() { m_newReportAction = new QAction(tr("New Report"),this); m_newReportAction->setIcon(QIcon(":/report/images/newReport")); - m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N)); + m_newReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N)); connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport())); m_newPageAction = new QAction(tr("New Report Page"),this); @@ -171,28 +175,28 @@ void ReportDesignWindow::createActions() m_undoAction = new QAction(tr("Undo"),this); m_undoAction->setIcon(QIcon(":/report/images/undo")); m_undoAction->setEnabled(false); - m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); + m_undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z)); connect(m_undoAction,SIGNAL(triggered()),this,SLOT(slotUndo())); m_redoAction = new QAction(tr("Redo"),this); m_redoAction->setIcon(QIcon(":/report/images/redo")); m_redoAction->setEnabled(false); - m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); + m_redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z)); connect(m_redoAction,SIGNAL(triggered()),this,SLOT(slotRedo())); m_copyAction = new QAction(tr("Copy"),this); m_copyAction->setIcon(QIcon(":/report/images/copy")); - m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); + m_copyAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C)); connect(m_copyAction,SIGNAL(triggered()),this,SLOT(slotCopy())); m_pasteAction = new QAction(tr("Paste"),this); m_pasteAction->setIcon(QIcon(":/report/images/paste")); - m_pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); + m_pasteAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V)); connect(m_pasteAction,SIGNAL(triggered()),this,SLOT(slotPaste())); m_cutAction = new QAction(tr("Cut"),this); m_cutAction->setIcon(QIcon(":/report/images/cut")); - m_cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); + m_cutAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X)); connect(m_cutAction,SIGNAL(triggered()),this,SLOT(slotCut())); m_settingsAction = new QAction(tr("Settings"),this); @@ -202,13 +206,13 @@ void ReportDesignWindow::createActions() m_useGridAction = new QAction(tr("Use grid"),this); m_useGridAction->setIcon(QIcon(":/report/images/grid")); m_useGridAction->setCheckable(true); - m_useGridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G)); + m_useGridAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_G)); connect(m_useGridAction,SIGNAL(toggled(bool)),this,SLOT(slotUseGrid(bool))); m_useMagnetAction = new QAction(tr("Use magnet"),this); m_useMagnetAction->setIcon(QIcon(":/report/images/magnet")); m_useMagnetAction->setCheckable(true); - m_useMagnetAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + m_useMagnetAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M)); connect(m_useMagnetAction,SIGNAL(toggled(bool)),this,SLOT(slotUseMagnet(bool))); @@ -219,17 +223,17 @@ void ReportDesignWindow::createActions() m_saveReportAction = new QAction(tr("Save Report"),this); m_saveReportAction->setIcon(QIcon(":/report/images/save")); - m_saveReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); + m_saveReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S)); connect(m_saveReportAction,SIGNAL(triggered()),this,SLOT(slotSaveReport())); m_saveReportAsAction = new QAction(tr("Save Report As"),this); m_saveReportAsAction->setIcon(QIcon(":/report/images/saveas")); - m_saveReportAsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); + m_saveReportAsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_S)); connect(m_saveReportAsAction,SIGNAL(triggered()),this,SLOT(slotSaveReportAs())); m_loadReportAction = new QAction(tr("Load Report"),this); m_loadReportAction->setIcon(QIcon(":/report/images/folder")); - m_loadReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); + m_loadReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_O)); connect(m_loadReportAction,SIGNAL(triggered()),this,SLOT(slotLoadReport())); m_deleteItemAction = new QAction(tr("Delete item"),this); @@ -247,7 +251,7 @@ void ReportDesignWindow::createActions() m_previewReportAction = new QAction(tr("Render Report"),this); m_previewReportAction->setIcon(QIcon(":/report/images/render")); - m_previewReportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P)); + m_previewReportAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_P)); connect(m_previewReportAction,SIGNAL(triggered()),this,SLOT(slotPreviewReport())); m_testAction = new QAction("test",this); @@ -274,13 +278,13 @@ void ReportDesignWindow::createActions() m_hideLeftPanel = new QAction(tr("Hide left panel | Alt+L"),this); m_hideLeftPanel->setCheckable(true); m_hideLeftPanel->setIcon(QIcon(":/report/images/hideLeftPanel")); - m_hideLeftPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_L)); + m_hideLeftPanel->setShortcut(QKeySequence(Qt::ALT | Qt::Key_L)); connect(m_hideLeftPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideLeftPanel(bool))); m_hideRightPanel = new QAction(tr("Hide right panel | Alt+R"),this); m_hideRightPanel->setCheckable(true); m_hideRightPanel->setIcon(QIcon(":/report/images/hideRightPanel")); - m_hideRightPanel->setShortcut(QKeySequence(Qt::ALT + Qt::Key_R)); + m_hideRightPanel->setShortcut(QKeySequence(Qt::ALT | Qt::Key_R)); connect(m_hideRightPanel,SIGNAL(toggled(bool)), this, SLOT(slotHideRightPanel(bool))); #ifdef HAVE_QTDESIGNER_INTEGRATION m_deleteDialogAction = new QAction(tr("Delete dialog"), this); @@ -294,19 +298,19 @@ void ReportDesignWindow::createActions() m_lockSelectedItemsAction = new QAction(tr("Lock selected items"), this); m_lockSelectedItemsAction->setIcon(QIcon(":/report/images/lock")); - m_lockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + m_lockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L)); connect(m_lockSelectedItemsAction, SIGNAL(triggered()), this, SLOT(slotLockSelectedItems())); m_unlockSelectedItemsAction = new QAction(tr("Unlock selected items"), this); m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock")); - m_unlockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L)); + m_unlockSelectedItemsAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_L)); connect(m_unlockSelectedItemsAction, SIGNAL(triggered()), this, SLOT(slotUnlockSelectedItems())); m_selectOneLevelItems = new QAction(tr("Select one level items"), this); //m_unlockSelectedItemsAction->setIcon(QIcon(":/report/images/unlock")); - m_selectOneLevelItems->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); + m_selectOneLevelItems->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_A)); connect(m_selectOneLevelItems, SIGNAL(triggered()), this, SLOT(slotSelectOneLevelItems())); } @@ -567,7 +571,7 @@ void ReportDesignWindow::createObjectInspector() QWidget* w = new QWidget(objectDoc); QVBoxLayout* l = new QVBoxLayout(w); l->addWidget(m_objectInspector); - l->setMargin(0); + l->setContentsMargins(0, 0, 0, 0); w->setLayout(l); objectDoc->setWindowTitle(tr("Object Inspector")); objectDoc->setWidget(w); @@ -833,11 +837,17 @@ void ReportDesignWindow::restoreSetting() if (v.isValid()){ restoreGeometry(v.toByteArray()); } else { +#if QT_VERSION < 0x060000 QDesktopWidget *desktop = QApplication::desktop(); int screenWidth = desktop->screenGeometry().width(); int screenHeight = desktop->screenGeometry().height(); +#else + QScreen *screen = QGuiApplication::primaryScreen(); + int screenWidth = screen->geometry().width(); + int screenHeight = screen->geometry().height(); +#endif int x = screenWidth * 0.1; int y = screenHeight * 0.1; @@ -1530,7 +1540,11 @@ void ReportDesignWindow::slotPageDeleted() void ReportDesignWindow::slotFilterTextChanged(const QString& filter) { +#if QT_VERSION < 0x060000 m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); +#else + m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption)); +#endif } #ifdef HAVE_QTDESIGNER_INTEGRATION diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index b0ab082..6e3ad3d 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 70fda8e..ba0e8d7 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -32,7 +32,11 @@ #include #include #include +#if QT_VERSION < 0x060000 #include +#else +#include +#endif #include #include #include @@ -272,15 +276,10 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer) if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) -#ifdef HAVE_QT4 - m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); -#endif -#ifdef HAVE_QT5 -#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) +#if QT_VERSION >= 0x050300 m_printer.data()->setPrinterName(pi.defaultPrinterName()); #else m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); -#endif #endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; @@ -394,15 +393,10 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) -#ifdef HAVE_QT4 - m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); -#endif -#ifdef HAVE_QT5 -#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) +#if QT_VERSION >= 0x050300 m_printer.data()->setPrinterName(pi.defaultPrinterName()); #else - m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); -#endif + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); #endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; @@ -1383,7 +1377,7 @@ ReportPages ReportEnginePrivate::renderToPages() ReportPages ReportEnginePrivate::appendPages(ReportPages s1, ReportPages s2, AppendType appendType) { - if (!s1.isEmpty()>0 && s1.size() == s2.size() && appendType == MixPages){ + if (!s1.isEmpty() && s1.size() == s2.size() && appendType == MixPages){ ReportPages result; ReportPages::Iterator s1It; ReportPages::Iterator s2It; @@ -1824,6 +1818,7 @@ PrintProcessor::PrintProcessor(QPrinter* printer) bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page) { +#if QT_VERSION < 0x060000 if (!m_firstPage && !m_painter->isActive()) return false; PageDesignIntf* backupPage = dynamic_cast(page->scene()); @@ -1885,11 +1880,76 @@ bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page) page->setPos(backupPagePos); m_renderPage.removePageItem(page); if (backupPage) backupPage->reactivatePageItem(page); +#else + if (!m_firstPage && !m_painter->isActive()) return false; + PageDesignIntf* backupPage = dynamic_cast(page->scene()); + + QPointF backupPagePos = page->pos(); + page->setPos(0,0); + m_renderPage.setPageItem(page); + m_renderPage.setSceneRect(m_renderPage.pageItem()->mapToScene(m_renderPage.pageItem()->rect()).boundingRect()); + initPrinter(m_renderPage.pageItem()); + + if (!m_firstPage){ + m_printer->newPage(); + } else { + m_painter = new QPainter(m_printer); + if (!m_painter->isActive()) return false; + m_firstPage = false; + } + + qreal leftMargin = m_printer->pageLayout().margins().left(); + qreal topMargin = m_printer->pageLayout().margins().top(); + qreal rightMargin = m_printer->pageLayout().margins().right(); + qreal bottomMargin = m_printer->pageLayout().margins().bottom(); + + QRectF printerPageRect = m_printer->pageRect(QPrinter::Millimeter); + printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * page->unitFactor(), + (printerPageRect.size().height() + bottomMargin + topMargin) * page->unitFactor()); + if (page->printBehavior() == PageItemDesignIntf::Split && m_printer->pageLayout().pageSize() != QPageSize((QPageSize::PageSizeId)page->pageSize()) && + printerPageRect.width() < page->geometry().width()) + { + qreal pageWidth = page->geometry().width(); + qreal pageHeight = page->geometry().height(); + QRectF currentPrintingRect = printerPageRect; + qreal curHeight = 0; + qreal curWidth = 0; + bool first = true; + while (pageHeight > 0){ + while (curWidth < pageWidth){ + if (!first) m_printer->newPage(); else first = false; + m_renderPage.render(m_painter, m_printer->pageRect(QPrinter::Millimeter), currentPrintingRect); + currentPrintingRect.adjust(printerPageRect.size().width(), 0, printerPageRect.size().width(), 0); + curWidth += printerPageRect.size().width(); + + } + pageHeight -= printerPageRect.size().height(); + curHeight += printerPageRect.size().height(); + currentPrintingRect = printerPageRect; + currentPrintingRect.adjust(0, curHeight, 0, curHeight); + curWidth = 0; + } + + } else { + if (page->getSetPageSizeToPrinter()){ + QRectF source = page->geometry(); + QSizeF inchSize = source.size() / (100 * 2.54); + QRectF target = QRectF(QPoint(0,0), inchSize * m_printer->resolution()); + m_renderPage.render(m_painter, target, source); + } else { + m_renderPage.render(m_painter); + } + } + page->setPos(backupPagePos); + m_renderPage.removePageItem(page); + if (backupPage) backupPage->reactivatePageItem(page); +#endif return true; } void PrintProcessor::initPrinter(PageItemDesignIntf* page) { +#if QT_VERSION < 0x060000 if (page->oldPrintMode()){ m_printer->setPageMargins(page->leftMargin(), page->topMargin(), @@ -1917,6 +1977,31 @@ void PrintProcessor::initPrinter(PageItemDesignIntf* page) m_printer->setPaperSize(static_cast(page->pageSize())); } } +#else + if (page->oldPrintMode()){ + m_printer->setPageMargins(QMarginsF(page->leftMargin(), page->topMargin(), page->rightMargin(), page->bottomMargin()),QPageLayout::Millimeter); + m_printer->setPageOrientation((QPageLayout::Orientation)page->pageOrientation()); + QSizeF pageSize = (page->pageOrientation()==PageItemDesignIntf::Landscape)? + QSizeF(page->sizeMM().height(),page->sizeMM().width()): + page->sizeMM(); + m_printer->setPageSize(QPageSize(pageSize, QPageSize::Millimeter)); + } else { + m_printer->setFullPage(page->fullPage()); + if (page->dropPrinterMargins()) + m_printer->setPageMargins(QMarginsF(0, 0, 0, 0), QPageLayout::Point); + m_printer->setPageOrientation((QPageLayout::Orientation)page->pageOrientation()); + if (page->pageSize()==PageItemDesignIntf::Custom){ + QSizeF pageSize = (page->pageOrientation()==PageItemDesignIntf::Landscape)? + QSizeF(page->sizeMM().height(),page->sizeMM().width()): + page->sizeMM(); + if (page->getSetPageSizeToPrinter() || m_printer->outputFormat() == QPrinter::PdfFormat) + m_printer->setPageSize(QPageSize(pageSize, QPageSize::Millimeter)); + } else { + if (page->getSetPageSizeToPrinter() || m_printer->outputFormat() == QPrinter::PdfFormat) + m_printer->setPageSize(QPageSize((QPageSize::PageSizeId)page->pageSize())); + } + } +#endif } qreal ItemGeometry::x() const diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 6509302..4fdfa37 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index dd501b9..b2ef220 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -138,7 +138,7 @@ class ReportEnginePrivate : public QObject, { Q_OBJECT Q_DECLARE_PUBLIC(ReportEngine) - Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader()) + Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader) Q_PROPERTY(QObject* datasourcesManager READ dataManager) Q_PROPERTY(QObject* scriptContext READ scriptContext) Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 58f0bd9..60e2adc 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -196,11 +196,15 @@ void ReportRender::analizeItem(ContentItemDesignIntf* contentItem, BandDesignInt QString content = contentItem->content(); QVector functions; foreach(const QString &functionName, m_datasources->groupFunctionNames()){ +#if QT_VERSION < 0x060000 QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); rx.setMinimal(true); if (rx.indexIn(content)>=0){ functions.append(functionName); } +#else + // TODO: Qt6 port +#endif } if (functions.size()>0) m_groupfunctionItems.insert(contentItem->patternName(), functions); @@ -361,10 +365,14 @@ bool ReportRender::containsGroupFunctions(BandDesignIntf *band){ if (contentItem){ QString content = contentItem->content(); foreach(QString functionName, m_datasources->groupFunctionNames()){ +#if QT_VERSION < 0x060000 QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); if (rx.indexIn(content)>=0){ return true; } +#else + // TODO: Qt6 port +#endif } } } @@ -372,6 +380,7 @@ bool ReportRender::containsGroupFunctions(BandDesignIntf *band){ } void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){ +#if QT_VERSION < 0x060000 if ( contentItem && contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}"))){ foreach(const QString &functionName, m_datasources->groupFunctionNames()){ QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); @@ -406,6 +415,9 @@ void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentIt } } } +#else + // TODO: Qt6 port +#endif } void ReportRender::extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band){ @@ -428,6 +440,7 @@ void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentIte if (m_groupfunctionItems.contains(contentItem->patternName())){ QString content = contentItem->content(); foreach(QString functionName, m_groupfunctionItems.value(contentItem->patternName())){ +#if QT_VERSION < 0x060000 QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); rx.setMinimal(true); if (rx.indexIn(content)>=0){ @@ -450,6 +463,9 @@ void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentIte pos += rx.matchedLength(); } } +#else + // TODO: Qt6 port +#endif } contentItem->setContent(content); } @@ -1142,10 +1158,9 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) band->setObjectName(band->objectName()+QString::number(++m_currentNameIndex)); renameChildItems(band); if (m_lastDataBand){ -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 m_lastDataBand->metaObject()->invokeMethod(m_lastDataBand,"bandRegistred"); -#endif -#ifdef HAVE_QT5 +#else emit m_lastDataBand->bandRegistred(); #endif } @@ -1244,6 +1259,8 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i upperBandPart->updateItemSize(m_datasources, FirstPass, height); registerBand(upperBandPart); upperBandPart->copyBookmarks(band); + if (patternBand->isFooter()) + closeFooterGroup(m_lastDataBand); } else delete upperBandPart; if (band->columnsCount()>1 && @@ -1352,7 +1369,7 @@ void ReportRender::cutGroups() m_popupedExpression.clear(); m_popupedValues.clear(); //foreach(BandDesignIntf* groupBand,m_childBands.keys()){ - for(BandDesignIntf* groupBand : m_childBands.keys()){ + foreach(BandDesignIntf* groupBand, m_childBands.keys()){ if (m_childBands.value(groupBand)->tryToKeepTogether()){ foreach(BandDesignIntf* band, *m_childBands.value(groupBand)){ m_renderPageItem->removeBand(band); @@ -1428,7 +1445,7 @@ void ReportRender::checkLostHeadersOnPrevPage() if (lostHeaders.size() > 0){ m_lostHeadersMoved = true; - //qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); + //std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); foreach(BandDesignIntf* header, lostHeaders){ registerBand(header); @@ -1466,7 +1483,7 @@ void ReportRender::checkLostHeadersInPrevColumn() if (lostHeaders.size() > 0){ m_lostHeadersMoved = true; -// qSort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); +// std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen); foreach(BandDesignIntf* header, lostHeaders){ registerBand(header); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 46a35d0..155b7a8 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -86,7 +86,7 @@ private: class ReportRender: public QObject { Q_OBJECT - Q_PROPERTY(QObject* datasourcesManager READ datasources()) + Q_PROPERTY(QObject* datasourcesManager READ datasources) public: enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage}; enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable }; diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 2cb9713..b027c2c 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -354,6 +354,7 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ QString ScriptEngineManager::expandUserVariables(QString context, RenderPass /* pass */, ExpandType expandType, QVariant &varValue) { +#if QT_VERSION < 0x060000 QRegExp rx(Const::VARIABLE_RX); if (context.contains(rx)){ int pos = 0; @@ -396,10 +397,62 @@ QString ScriptEngineManager::expandUserVariables(QString context, RenderPass /* } } return context; +#else + QRegularExpression rx(Const::VARIABLE_RX); + if (context.contains(rx)){ + int pos = 0; + QRegularExpressionMatch match = rx.match(context, pos); + while (match.hasMatch()){ + + QString variable=match.captured(1); + pos = match.capturedEnd(); + + if (dataManager()->containsVariable(variable) ){ + try { + + varValue = dataManager()->variable(variable); + switch (expandType){ + case EscapeSymbols: + context.replace(match.captured(0), escapeSimbols(varValue.toString())); + break; + case NoEscapeSymbols: + context.replace(match.captured(0), varValue.toString()); + break; + case ReplaceHTMLSymbols: + context.replace(match.captured(0), replaceHTMLSymbols(varValue.toString())); + break; + } + + pos = 0; + + } catch (ReportError &e){ + dataManager()->putError(e.what()); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(match.captured(0), e.what()); + else + context.replace(match.captured(0), ""); + } + } else { + + QString error; + error = tr("Variable %1 not found").arg(variable); + dataManager()->putError(error); + if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(match.captured(0), error); + else + context.replace(match.captured(0), ""); + } + + match = rx.match(context, pos); + } + } + return context; +#endif } QString ScriptEngineManager::expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject *reportItem) { +#if QT_VERSION < 0x060000 QRegExp rx(Const::FIELD_RX); if (context.contains(rx)){ @@ -450,13 +503,74 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand } return context; +#else + QRegularExpression rx(Const::FIELD_RX); + + if (context.contains(rx)){ + QRegularExpressionMatch match = rx.match(context); + while (match.hasMatch()){ + + QString field=match.captured(1); + + if (dataManager()->containsField(field)) { + QString fieldValue; + varValue = dataManager()->fieldData(field); + if (expandType == EscapeSymbols) { + if (varValue.isNull()) { + fieldValue="\"\""; + } else { + fieldValue = escapeSimbols(varValue.toString()); + switch (dataManager()->fieldData(field).type()) { + case QVariant::Char: + case QVariant::String: + case QVariant::StringList: + case QVariant::Date: + case QVariant::DateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; + } + } + } else { + if (expandType == ReplaceHTMLSymbols) + fieldValue = replaceHTMLSymbols(varValue.toString()); + else fieldValue = varValue.toString(); + } + + context.replace(match.captured(0),fieldValue); + + } else { + QString error; + if (reportItem){ + error = tr("Field %1 not found in %2!").arg(field).arg(reportItem->objectName()); + dataManager()->putError(error); + } + varValue = QVariant(); + if (!dataManager()->reportSettings() || !dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings()) + context.replace(match.captured(0), error); + else + context.replace(match.captured(0), ""); + } + match = rx.match(context); + } + } + + return context; +#endif } QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, QObject *reportItem) { +#if QT_VERSION < 0x060000 QRegExp rx(Const::SCRIPT_RX); if (context.contains(rx)){ +#else + QRegularExpression rx(Const::SCRIPT_RX, QRegularExpression::DotMatchesEverythingOption); + + if(context.contains(rx)){ +#endif if (ScriptEngineManager::instance().dataManager() != dataManager()) ScriptEngineManager::instance().setDataManager(dataManager()); @@ -517,10 +631,17 @@ QString ScriptEngineManager::replaceScripts(QString context, QVariant &varValue, QVariant ScriptEngineManager::evaluateScript(const QString& script){ +#if QT_VERSION < 0x060000 QRegExp rx(Const::SCRIPT_RX); QVariant varValue; if (script.contains(rx)){ +#else + QRegularExpression rx(Const::SCRIPT_RX); + QVariant varValue; + + if (script.contains(rx)){ +#endif if (ScriptEngineManager::instance().dataManager()!=dataManager()) ScriptEngineManager::instance().setDataManager(dataManager()); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index ce8e7ef..7c3bccd 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrscriptenginemanagerintf.h b/limereport/lrscriptenginemanagerintf.h index a8a7c63..573f748 100644 --- a/limereport/lrscriptenginemanagerintf.h +++ b/limereport/lrscriptenginemanagerintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -31,7 +31,7 @@ #define LRSCRIPTENGINEMANAGERINTF_H #include "qglobal.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) +#if QT_VERSION >= 0x050600 #ifndef USE_QTSCRIPTENGINE #ifndef USE_QJSENGINE #define USE_QJSENGINE diff --git a/limereport/lrsettingdialog.cpp b/limereport/lrsettingdialog.cpp index 05374a3..6568e0e 100644 --- a/limereport/lrsettingdialog.cpp +++ b/limereport/lrsettingdialog.cpp @@ -106,7 +106,7 @@ void SettingDialog::setScritpTabIndention(int size) void SettingDialog::setTheme(const QString &theme) { -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(theme)); #else ui->cbTheme->setCurrentText(theme); @@ -128,7 +128,7 @@ void SettingDialog::setDesignerLanguages(QList languages, QLo if (language != currentLanguage) ui->designerLanguage->addItem(QLocale::languageToString(language)); } -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->designerLanguage->setCurrentIndex(ui->designerLanguage->findText(QLocale::languageToString(currentLanguage))); #else ui->designerLanguage->setCurrentText(QLocale::languageToString(currentLanguage)); @@ -139,7 +139,7 @@ void SettingDialog::setDesignerThemes(QList themes, const QString &curr { ui->cbTheme->clear(); ui->cbTheme->addItems(themes); -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentTheme)); #else ui->cbTheme->setCurrentText(currentTheme); @@ -150,8 +150,8 @@ void SettingDialog::setDesignerUnites(QList unitTypes, const QString cu { ui->reportUnits->clear(); ui->reportUnits->addItems(unitTypes); -#ifdef HAVE_QT4 - ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType)); +#if QT_VERSION < 0x050000 + ui->reportUnits->setCurrentIndex(ui->reportUnits->findText(currentUnitType)); #else ui->reportUnits->setCurrentText(currentUnitType); #endif diff --git a/limereport/lrsimplecrypt.cpp b/limereport/lrsimplecrypt.cpp index bc28a53..9647434 100644 --- a/limereport/lrsimplecrypt.cpp +++ b/limereport/lrsimplecrypt.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrsimplecrypt.h b/limereport/lrsimplecrypt.h index 4088726..6ba0b7e 100644 --- a/limereport/lrsimplecrypt.h +++ b/limereport/lrsimplecrypt.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrvariablesholder.cpp b/limereport/lrvariablesholder.cpp index 4e79084..9cbfcd1 100644 --- a/limereport/lrvariablesholder.cpp +++ b/limereport/lrvariablesholder.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/lrvariablesholder.h b/limereport/lrvariablesholder.h index 76446b5..c9f6ff6 100644 --- a/limereport/lrvariablesholder.h +++ b/limereport/lrvariablesholder.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrbuttonlineeditor.cpp b/limereport/objectinspector/editors/lrbuttonlineeditor.cpp index 8459594..4eead43 100644 --- a/limereport/objectinspector/editors/lrbuttonlineeditor.cpp +++ b/limereport/objectinspector/editors/lrbuttonlineeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -34,7 +34,11 @@ #include #include #include +#if QT_VERSION < 0x060000 #include +#else +#include +#endif #include "lrtextitempropertyeditor.h" namespace LimeReport{ @@ -66,7 +70,11 @@ void ButtonLineEditor::editButtonClicked() { TextItemPropertyEditor* editor = new TextItemPropertyEditor(QApplication::activeWindow()); editor->setAttribute(Qt::WA_DeleteOnClose); +#if QT_VERSION < 0x060000 editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QApplication::desktop()->availableGeometry())); +#else + editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QGuiApplication::screens().first()->availableGeometry())); +#endif editor->setWindowTitle(m_propertyName); editor->setText(m_lineEdit->text()); connect(editor,SIGNAL(accepted()),this,SLOT(editingByEditorFinished())); diff --git a/limereport/objectinspector/editors/lrbuttonlineeditor.h b/limereport/objectinspector/editors/lrbuttonlineeditor.h index 81d274e..4757d88 100644 --- a/limereport/objectinspector/editors/lrbuttonlineeditor.h +++ b/limereport/objectinspector/editors/lrbuttonlineeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcheckboxeditor.cpp b/limereport/objectinspector/editors/lrcheckboxeditor.cpp index 1247ceb..3911540 100644 --- a/limereport/objectinspector/editors/lrcheckboxeditor.cpp +++ b/limereport/objectinspector/editors/lrcheckboxeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcheckboxeditor.h b/limereport/objectinspector/editors/lrcheckboxeditor.h index 67c95bf..8f558cb 100644 --- a/limereport/objectinspector/editors/lrcheckboxeditor.h +++ b/limereport/objectinspector/editors/lrcheckboxeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcoloreditor.cpp b/limereport/objectinspector/editors/lrcoloreditor.cpp index 09c22d6..bac93a2 100644 --- a/limereport/objectinspector/editors/lrcoloreditor.cpp +++ b/limereport/objectinspector/editors/lrcoloreditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcoloreditor.h b/limereport/objectinspector/editors/lrcoloreditor.h index f77fe81..c8227e9 100644 --- a/limereport/objectinspector/editors/lrcoloreditor.h +++ b/limereport/objectinspector/editors/lrcoloreditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcomboboxeditor.cpp b/limereport/objectinspector/editors/lrcomboboxeditor.cpp index 3980444..d034c50 100644 --- a/limereport/objectinspector/editors/lrcomboboxeditor.cpp +++ b/limereport/objectinspector/editors/lrcomboboxeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrcomboboxeditor.h b/limereport/objectinspector/editors/lrcomboboxeditor.h index b03d619..a752579 100644 --- a/limereport/objectinspector/editors/lrcomboboxeditor.h +++ b/limereport/objectinspector/editors/lrcomboboxeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrfonteditor.cpp b/limereport/objectinspector/editors/lrfonteditor.cpp index 1f3e97b..55e6230 100644 --- a/limereport/objectinspector/editors/lrfonteditor.cpp +++ b/limereport/objectinspector/editors/lrfonteditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrfonteditor.h b/limereport/objectinspector/editors/lrfonteditor.h index 256ba2b..d5fa17a 100644 --- a/limereport/objectinspector/editors/lrfonteditor.h +++ b/limereport/objectinspector/editors/lrfonteditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrimageeditor.cpp b/limereport/objectinspector/editors/lrimageeditor.cpp index aae4f99..4066116 100644 --- a/limereport/objectinspector/editors/lrimageeditor.cpp +++ b/limereport/objectinspector/editors/lrimageeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrimageeditor.h b/limereport/objectinspector/editors/lrimageeditor.h index 4b116b7..999032b 100644 --- a/limereport/objectinspector/editors/lrimageeditor.h +++ b/limereport/objectinspector/editors/lrimageeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrtextitempropertyeditor.cpp b/limereport/objectinspector/editors/lrtextitempropertyeditor.cpp index 84192fd..e5a036d 100644 --- a/limereport/objectinspector/editors/lrtextitempropertyeditor.cpp +++ b/limereport/objectinspector/editors/lrtextitempropertyeditor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/editors/lrtextitempropertyeditor.h b/limereport/objectinspector/editors/lrtextitempropertyeditor.h index 367941b..22e14de 100644 --- a/limereport/objectinspector/editors/lrtextitempropertyeditor.h +++ b/limereport/objectinspector/editors/lrtextitempropertyeditor.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrbasedesignobjectmodel.cpp b/limereport/objectinspector/lrbasedesignobjectmodel.cpp index 8f22a97..b83904c 100644 --- a/limereport/objectinspector/lrbasedesignobjectmodel.cpp +++ b/limereport/objectinspector/lrbasedesignobjectmodel.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrbasedesignobjectmodel.h b/limereport/objectinspector/lrbasedesignobjectmodel.h index 518d3a8..4d50a78 100644 --- a/limereport/objectinspector/lrbasedesignobjectmodel.h +++ b/limereport/objectinspector/lrbasedesignobjectmodel.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrobjectinspectorwidget.cpp b/limereport/objectinspector/lrobjectinspectorwidget.cpp index 1a3be38..413c403 100644 --- a/limereport/objectinspector/lrobjectinspectorwidget.cpp +++ b/limereport/objectinspector/lrobjectinspectorwidget.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -167,8 +167,12 @@ void ObjectInspectorTreeView::commitActiveEditorData(){ bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - if (sourceParent.isValid()) return true; + if (sourceParent.isValid()) return true; +#if QT_VERSION < 0x060000 return sourceModel()->data(index).toString().contains(filterRegExp()); +#else + return sourceModel()->data(index).toString().contains(filterRegularExpression()); +#endif } ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent) @@ -178,7 +182,11 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent) m_propertyModel = new BaseDesignPropertyModel(this); m_filterModel = new PropertyFilterModel(this); m_filterModel->setSourceModel(m_propertyModel); +#if QT_VERSION < 0x060000 m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString)); +#else + m_filterModel->setFilterRegularExpression(QRegularExpression("", QRegularExpression::CaseInsensitiveOption)); +#endif m_objectInspectorView->setModel(m_filterModel); QVBoxLayout* l = new QVBoxLayout(); QLineEdit* le = new QLineEdit(this); @@ -209,7 +217,8 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent) h->addWidget(settingButton); l->addLayout(h); l->addWidget(m_objectInspectorView); - l->setMargin(Const::DOCKWIDGET_MARGINS); + int margin = Const::DOCKWIDGET_MARGINS; + l->setContentsMargins(margin, margin, margin, margin); l->setSpacing(2); this->setLayout(l); } @@ -305,7 +314,11 @@ void ObjectInspectorWidget::updateProperty(const QString &propertyName) void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter) { if (m_filterModel) +#if QT_VERSION < 0x060000 m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); +#else + m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption)); +#endif } void ObjectInspectorWidget::slotTranslatePropertiesChecked(bool value) diff --git a/limereport/objectinspector/lrobjectinspectorwidget.h b/limereport/objectinspector/lrobjectinspectorwidget.h index fb1d0a6..2244887 100644 --- a/limereport/objectinspector/lrobjectinspectorwidget.h +++ b/limereport/objectinspector/lrobjectinspectorwidget.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 65e2f4a..6b5ca7d 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrobjectitemmodel.h b/limereport/objectinspector/lrobjectitemmodel.h index 2aa1f8b..2beb0dd 100644 --- a/limereport/objectinspector/lrobjectitemmodel.h +++ b/limereport/objectinspector/lrobjectitemmodel.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrobjectpropitem.cpp b/limereport/objectinspector/lrobjectpropitem.cpp index 6ef6613..638dd4c 100644 --- a/limereport/objectinspector/lrobjectpropitem.cpp +++ b/limereport/objectinspector/lrobjectpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -93,7 +93,7 @@ void ObjectPropItem::appendItem(ObjectPropItem *item){ void ObjectPropItem::sortItem() { - qSort(m_childItems.begin(), m_childItems.end(), lesThen); + std::sort(m_childItems.begin(), m_childItems.end(), lesThen); } QVariant ObjectPropItem::propertyValue() const { diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index f765213..d557cd7 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrpropertydelegate.cpp b/limereport/objectinspector/lrpropertydelegate.cpp index 3a67cdc..cb5fa39 100644 --- a/limereport/objectinspector/lrpropertydelegate.cpp +++ b/limereport/objectinspector/lrpropertydelegate.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/lrpropertydelegate.h b/limereport/objectinspector/lrpropertydelegate.h index b64cdae..f21c692 100644 --- a/limereport/objectinspector/lrpropertydelegate.h +++ b/limereport/objectinspector/lrpropertydelegate.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrboolpropitem.cpp b/limereport/objectinspector/propertyItems/lrboolpropitem.cpp index 6e462a2..0529453 100644 --- a/limereport/objectinspector/propertyItems/lrboolpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrboolpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrboolpropitem.h b/limereport/objectinspector/propertyItems/lrboolpropitem.h index 9331c3d..fec0c83 100644 --- a/limereport/objectinspector/propertyItems/lrboolpropitem.h +++ b/limereport/objectinspector/propertyItems/lrboolpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp b/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp index a47f77c..96e9e5b 100644 --- a/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrcolorpropitem.h b/limereport/objectinspector/propertyItems/lrcolorpropitem.h index 6d0b8de..b30f697 100644 --- a/limereport/objectinspector/propertyItems/lrcolorpropitem.h +++ b/limereport/objectinspector/propertyItems/lrcolorpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrdatasourcepropitem.cpp b/limereport/objectinspector/propertyItems/lrdatasourcepropitem.cpp index 6a3f1b6..15da9fb 100644 --- a/limereport/objectinspector/propertyItems/lrdatasourcepropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrdatasourcepropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrdatasourcepropitem.h b/limereport/objectinspector/propertyItems/lrdatasourcepropitem.h index 60f7062..7149325 100644 --- a/limereport/objectinspector/propertyItems/lrdatasourcepropitem.h +++ b/limereport/objectinspector/propertyItems/lrdatasourcepropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrenumpropitem.cpp b/limereport/objectinspector/propertyItems/lrenumpropitem.cpp index 385b2d6..b9a1a0c 100644 --- a/limereport/objectinspector/propertyItems/lrenumpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrenumpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrenumpropitem.h b/limereport/objectinspector/propertyItems/lrenumpropitem.h index 4553d10..b610e20 100644 --- a/limereport/objectinspector/propertyItems/lrenumpropitem.h +++ b/limereport/objectinspector/propertyItems/lrenumpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrflagspropitem.cpp b/limereport/objectinspector/propertyItems/lrflagspropitem.cpp index 91d142e..d932144 100644 --- a/limereport/objectinspector/propertyItems/lrflagspropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrflagspropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrflagspropitem.h b/limereport/objectinspector/propertyItems/lrflagspropitem.h index 1005a8b..dae5e96 100644 --- a/limereport/objectinspector/propertyItems/lrflagspropitem.h +++ b/limereport/objectinspector/propertyItems/lrflagspropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp index 3e14fea..58f26fe 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrfontpropitem.h b/limereport/objectinspector/propertyItems/lrfontpropitem.h index a5a3cfd..654ba8a 100644 --- a/limereport/objectinspector/propertyItems/lrfontpropitem.h +++ b/limereport/objectinspector/propertyItems/lrfontpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.cpp b/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.cpp index 890f833..86dda68 100644 --- a/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.h b/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.h index 3f72fff..e51f297 100644 --- a/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.h +++ b/limereport/objectinspector/propertyItems/lrgroupfieldpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrimagepropitem.cpp b/limereport/objectinspector/propertyItems/lrimagepropitem.cpp index e44797d..31c37fd 100644 --- a/limereport/objectinspector/propertyItems/lrimagepropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrimagepropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrimagepropitem.h b/limereport/objectinspector/propertyItems/lrimagepropitem.h index e61c9b9..ab97f05 100644 --- a/limereport/objectinspector/propertyItems/lrimagepropitem.h +++ b/limereport/objectinspector/propertyItems/lrimagepropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrintpropitem.cpp b/limereport/objectinspector/propertyItems/lrintpropitem.cpp index 4f6f374..172c40e 100644 --- a/limereport/objectinspector/propertyItems/lrintpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrintpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrintpropitem.h b/limereport/objectinspector/propertyItems/lrintpropitem.h index 2d49f21..d9a2fbb 100644 --- a/limereport/objectinspector/propertyItems/lrintpropitem.h +++ b/limereport/objectinspector/propertyItems/lrintpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrmarginpropitem.cpp b/limereport/objectinspector/propertyItems/lrmarginpropitem.cpp index 66bbc25..469cfda 100644 --- a/limereport/objectinspector/propertyItems/lrmarginpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrmarginpropitem.cpp @@ -42,6 +42,7 @@ QString MarginPropItem::displayValue() const return QString("%1 %2").arg((propertyValue().toDouble() * Const::mmFACTOR) / (item->unitFactor() * 10), 0, 'f', 2) .arg(QObject::tr("''")); } + return QString(); } QWidget *MarginPropItem::createProperyEditor(QWidget *parent) const @@ -74,6 +75,7 @@ qreal MarginPropItem::valueInUnits(qreal value) const case LimeReport::BaseDesignIntf::Inches: return (value * Const::mmFACTOR) / (item->unitFactor() * 10); } + return 0; } qreal MarginPropItem::valueInReportUnits(qreal value) const @@ -84,8 +86,8 @@ qreal MarginPropItem::valueInReportUnits(qreal value) const return value; case LimeReport::BaseDesignIntf::Inches: return (value * (item->unitFactor() * 10)) / Const::mmFACTOR; - } + return 0; } QString MarginPropItem::unitShortName() const @@ -97,6 +99,7 @@ QString MarginPropItem::unitShortName() const case LimeReport::BaseDesignIntf::Inches: return QObject::tr("''"); } + return QString(); } } // namespace LimeReport diff --git a/limereport/objectinspector/propertyItems/lrqrealpropitem.cpp b/limereport/objectinspector/propertyItems/lrqrealpropitem.cpp index 2d27868..5e4dd66 100644 --- a/limereport/objectinspector/propertyItems/lrqrealpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrqrealpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrqrealpropitem.h b/limereport/objectinspector/propertyItems/lrqrealpropitem.h index c8a2616..1767395 100644 --- a/limereport/objectinspector/propertyItems/lrqrealpropitem.h +++ b/limereport/objectinspector/propertyItems/lrqrealpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrrectproptem.cpp b/limereport/objectinspector/propertyItems/lrrectproptem.cpp index a5503f7..20c2b56 100644 --- a/limereport/objectinspector/propertyItems/lrrectproptem.cpp +++ b/limereport/objectinspector/propertyItems/lrrectproptem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -171,6 +171,7 @@ qreal LimeReport::RectUnitValuePropItem::valueInUnits(qreal value) const case LimeReport::BaseDesignIntf::Inches: return value / (item->unitFactor() * 10); } + return 0; } qreal LimeReport::RectUnitValuePropItem::valueInReportUnits(qreal value) const @@ -182,6 +183,7 @@ qreal LimeReport::RectUnitValuePropItem::valueInReportUnits(qreal value) const case LimeReport::BaseDesignIntf::Inches: return value * (item->unitFactor() * 10); } + return 0; } QString LimeReport::RectUnitValuePropItem::unitShortName() const @@ -193,6 +195,7 @@ QString LimeReport::RectUnitValuePropItem::unitShortName() const case LimeReport::BaseDesignIntf::Inches: return QObject::tr("''"); } + return QString(); } QString LimeReport::RectUnitValuePropItem::displayValue() const @@ -258,6 +261,7 @@ QRectF LimeReport::RectUnitPropItem::rectInUnits(QRectF rect) const rect.width() / (item->unitFactor() * 10), rect.height() / (item->unitFactor() * 10)); } + return QRectF(); } QString LimeReport::RectUnitPropItem::unitShortName() const @@ -269,4 +273,5 @@ QString LimeReport::RectUnitPropItem::unitShortName() const case LimeReport::BaseDesignIntf::Inches: return QObject::tr("''"); } + return QString(); } diff --git a/limereport/objectinspector/propertyItems/lrrectproptem.h b/limereport/objectinspector/propertyItems/lrrectproptem.h index bd6915c..c7ce569 100644 --- a/limereport/objectinspector/propertyItems/lrrectproptem.h +++ b/limereport/objectinspector/propertyItems/lrrectproptem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrstringpropitem.cpp b/limereport/objectinspector/propertyItems/lrstringpropitem.cpp index b742c55..b594d35 100644 --- a/limereport/objectinspector/propertyItems/lrstringpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrstringpropitem.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectinspector/propertyItems/lrstringpropitem.h b/limereport/objectinspector/propertyItems/lrstringpropitem.h index 091ef1c..60bc722 100644 --- a/limereport/objectinspector/propertyItems/lrstringpropitem.h +++ b/limereport/objectinspector/propertyItems/lrstringpropitem.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/objectsbrowser/lrobjectbrowser.cpp b/limereport/objectsbrowser/lrobjectbrowser.cpp index a86fac3..dd2177e 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.cpp +++ b/limereport/objectsbrowser/lrobjectbrowser.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -40,7 +40,8 @@ ObjectBrowser::ObjectBrowser(QWidget *parent) { QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); - layout->setMargin(Const::DOCKWIDGET_MARGINS); + int margin = Const::DOCKWIDGET_MARGINS; + layout->setContentsMargins(margin, margin, margin, margin); m_treeView = new QTreeWidget(this); layout->addWidget(m_treeView); m_treeView->headerItem()->setText(0,tr("Objects")); diff --git a/limereport/objectsbrowser/lrobjectbrowser.h b/limereport/objectsbrowser/lrobjectbrowser.h index 3616c41..8008e1c 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.h +++ b/limereport/objectsbrowser/lrobjectbrowser.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/scriptbrowser/lrscriptbrowser.cpp b/limereport/scriptbrowser/lrscriptbrowser.cpp index 4407170..ae8ddc5 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.cpp +++ b/limereport/scriptbrowser/lrscriptbrowser.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -43,7 +43,8 @@ ScriptBrowser::ScriptBrowser(QWidget *parent) : ui(new Ui::ScriptBrowser) { ui->setupUi(this); - ui->verticalLayout->setMargin(Const::DOCKWIDGET_MARGINS); + int margin = Const::DOCKWIDGET_MARGINS; + ui->verticalLayout->setContentsMargins(margin, margin, margin, margin); #ifndef HAVE_UI_LOADER ui->tpDialogs->setVisible(false); ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tpDialogs)); diff --git a/limereport/scriptbrowser/lrscriptbrowser.h b/limereport/scriptbrowser/lrscriptbrowser.h index a004eef..5ac96da 100644 --- a/limereport/scriptbrowser/lrscriptbrowser.h +++ b/limereport/scriptbrowser/lrscriptbrowser.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/scripteditor/lrcodeeditor.cpp b/limereport/scripteditor/lrcodeeditor.cpp index c983dd9..772b064 100644 --- a/limereport/scripteditor/lrcodeeditor.cpp +++ b/limereport/scripteditor/lrcodeeditor.cpp @@ -46,8 +46,8 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) QPainter painter(lineNumberArea); QStyleOption option; option.initFrom(this); - //painter.fillRect(event->rect(), QPalette().background().color()); - QColor bg = option.palette.background().color().darker(150); + //painter.fillRect(event->rect(), QPalette().window().color()); + QColor bg = option.palette.window().color().darker(150); painter.fillRect(event->rect(), bg); QTextBlock block = firstVisibleBlock(); @@ -79,7 +79,7 @@ int CodeEditor::lineNumberAreaWidth() ++digits; } - int space = fontMetrics().width(QLatin1Char('9'))*2 + fontMetrics().width(QLatin1Char('9')) * digits; + int space = fontMetrics().boundingRect(QLatin1Char('9')).width()*2 + fontMetrics().boundingRect(QLatin1Char('9')).width() * digits; return space; } @@ -300,7 +300,7 @@ void CodeEditor::highlightCurrentLine() if (!isReadOnly()) { QTextEdit::ExtraSelection selection; - QColor lineColor = QColor(QPalette().background().color()).darker(100); + QColor lineColor = QColor(QPalette().window().color()).darker(100); selection.format.setBackground(lineColor); selection.format.setProperty(QTextFormat::FullWidthSelection, true); diff --git a/limereport/scripteditor/lrscripteditor.cpp b/limereport/scripteditor/lrscripteditor.cpp index 7c9656d..34e2c74 100644 --- a/limereport/scripteditor/lrscripteditor.cpp +++ b/limereport/scripteditor/lrscripteditor.cpp @@ -20,7 +20,11 @@ ScriptEditor::ScriptEditor(QWidget *parent) : setFocusProxy(ui->textEdit); m_completer = new ReportStructureCompleater(this); ui->textEdit->setCompleter(m_completer); - ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("0")*m_tabIndention); +#if QT_VERSION < 0x060000 + ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("0").width()*m_tabIndention); +#else + ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("0").width()*m_tabIndention); +#endif connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SIGNAL(splitterMoved(int,int))); connect(ui->textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged())); } @@ -86,7 +90,11 @@ void ScriptEditor::setPageBand(BandDesignIntf* band) void ScriptEditor::setTabIndention(int charCount) { if (m_tabIndention != charCount){ - ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("W")*charCount); +#if QT_VERSION < 0x060000 + ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount); +#else + ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount); +#endif m_tabIndention = charCount; } } diff --git a/limereport/scripteditor/lrscripthighlighter.cpp b/limereport/scripteditor/lrscripthighlighter.cpp index 87a0aa5..1877223 100644 --- a/limereport/scripteditor/lrscripthighlighter.cpp +++ b/limereport/scripteditor/lrscripthighlighter.cpp @@ -34,7 +34,7 @@ enum LiteralsType { }; enum States { - Undefinded = -1, + Undefined = -1, Start, MayBeKeyWord, Code, @@ -67,8 +67,8 @@ void ScriptHighlighter::highlightBlock(const QString& text) int literal = -1; bool lastWasBackSlash = false; States prevState = (States)previousBlockState(); - States state = prevState != Undefinded ? (States)prevState : Start; - States oldState = Undefinded; + States state = prevState != Undefined ? (States)prevState : Start; + States oldState = Undefined; const States stateMaschine[StatesCount][LiteralsCount] = { // Space Alpahabet Number Hash Slash Asterix, Bracket, Quotation, Apostrophe, Apostrophe2 Separator, Back Slash {Separator, MayBeKeyWord, MayBeNumber, Separator, MayBeComment, Separator, Separator, String, String2, String3, Separator, Separator}, @@ -87,7 +87,7 @@ void ScriptHighlighter::highlightBlock(const QString& text) QString buffer; - setCurrentBlockState(Undefinded); + setCurrentBlockState(Undefined); if (text.isEmpty()) { @@ -172,7 +172,7 @@ void ScriptHighlighter::highlightBlock(const QString& text) switch(oldState){ case MayBeComment2End: setFormat(i-(buffer.length()-1), buffer.length(), m_formats[CommentFormat]); - setCurrentBlockState(Undefinded); + setCurrentBlockState(Undefined); buffer.clear(); break; case MayBeKeyWord: @@ -214,16 +214,20 @@ void ScriptHighlighter::highlightBlock(const QString& text) if (buffer.length()) { - if (oldState == MayBeKeyWord) + if (state == MayBeKeyWord) { if (isKeyWord(buffer)) - setFormat(i - buffer.length(), buffer.length(), m_formats[KeywordFormat]); + setFormat(i - buffer.length(), buffer.length(), m_formats[KeywordFormat]); + } + else if (state == MayBeNumber) + { + setFormat(i - buffer.length(), buffer.length(), m_formats[NumberFormat]); } } TextBlockData *data = new TextBlockData; - for (int i = 0; i < PARENHEIS_COUNT; ++i){ + for (int i = 0; i < PARENHEIS_COUNT; ++i) { createParentheisisInfo(parenthesisCharacters[LeftParenthesis][i].toLatin1(), data, text); createParentheisisInfo(parenthesisCharacters[RightParenthesis][i].toLatin1(), data, text); } @@ -243,7 +247,7 @@ ScriptHighlighter::ScriptHighlighter(QTextDocument* parent): m_keywords.insert(keywords[i]); } - if ( isColorDark(QPalette().background().color())){ + if ( isColorDark(QPalette().window().color())){ m_formats[NumberFormat].setForeground(Qt::darkBlue); m_formats[StringFormat].setForeground(Qt::darkGreen); m_formats[KeywordFormat].setForeground(Qt::darkYellow); diff --git a/limereport/serializators/lrserializatorintf.h b/limereport/serializators/lrserializatorintf.h index b16263a..452922e 100644 --- a/limereport/serializators/lrserializatorintf.h +++ b/limereport/serializators/lrserializatorintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrstorageintf.h b/limereport/serializators/lrstorageintf.h index 74b83ef..e0ec406 100644 --- a/limereport/serializators/lrstorageintf.h +++ b/limereport/serializators/lrstorageintf.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlbasetypesserializators.cpp b/limereport/serializators/lrxmlbasetypesserializators.cpp index 559bee9..d5f0fb9 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.cpp +++ b/limereport/serializators/lrxmlbasetypesserializators.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** @@ -197,7 +197,7 @@ QVariant XmlFontSerializator::loadValue() //#if QT_VERSION>0x040800 // font.setStyleName(node()->attribute("stylename")); //#endif - font.setWeight(node()->attribute("weight").toInt()); + font.setWeight(static_cast(node()->attribute("weight").toInt())); if (!node()->attribute("bold").isEmpty()) font.setBold(node()->attribute("bold").toInt()); font.setItalic(node()->attribute("italic").toInt()); diff --git a/limereport/serializators/lrxmlbasetypesserializators.h b/limereport/serializators/lrxmlbasetypesserializators.h index 56f62c1..8662503 100644 --- a/limereport/serializators/lrxmlbasetypesserializators.h +++ b/limereport/serializators/lrxmlbasetypesserializators.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlqrectserializator.cpp b/limereport/serializators/lrxmlqrectserializator.cpp index 8b5ff09..3ef2a39 100644 --- a/limereport/serializators/lrxmlqrectserializator.cpp +++ b/limereport/serializators/lrxmlqrectserializator.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlqrectserializator.h b/limereport/serializators/lrxmlqrectserializator.h index cc26275..b41dc93 100644 --- a/limereport/serializators/lrxmlqrectserializator.h +++ b/limereport/serializators/lrxmlqrectserializator.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 7439fc4..3925128 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlreader.h b/limereport/serializators/lrxmlreader.h index 3dbbc5c..dd92d7d 100644 --- a/limereport/serializators/lrxmlreader.h +++ b/limereport/serializators/lrxmlreader.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlserializatorsfactory.h b/limereport/serializators/lrxmlserializatorsfactory.h index 5d76e06..1f3d695 100644 --- a/limereport/serializators/lrxmlserializatorsfactory.h +++ b/limereport/serializators/lrxmlserializatorsfactory.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index af353f5..7da6046 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/serializators/lrxmlwriter.h b/limereport/serializators/lrxmlwriter.h index 05d47a7..cbd4d4b 100644 --- a/limereport/serializators/lrxmlwriter.h +++ b/limereport/serializators/lrxmlwriter.h @@ -1,6 +1,6 @@ /*************************************************************************** * This file is part of the Lime Report project * - * Copyright (C) 2015 by Alexander Arin * + * Copyright (C) 2021 by Alexander Arin * * arin_a@bk.ru * * * ** GNU General Public License Usage ** diff --git a/limereport/translationeditor/languageselectdialog.cpp b/limereport/translationeditor/languageselectdialog.cpp index 64265c8..62aefb3 100644 --- a/limereport/translationeditor/languageselectdialog.cpp +++ b/limereport/translationeditor/languageselectdialog.cpp @@ -12,11 +12,10 @@ LanguageSelectDialog::LanguageSelectDialog(QWidget *parent) : for (int i = 2; icomboBox->addItem(QLocale::languageToString(static_cast(i)),static_cast(i)); } -#ifdef HAVE_QT5 - ui->comboBox->setCurrentText(""); -#endif -#ifdef HAVE_QT4 +#if QT_VERSION < 0x050000 ui->comboBox->setEditText(""); +#else + ui->comboBox->setCurrentText(""); #endif } diff --git a/lrdview/MainWindow.cpp b/lrdview/MainWindow.cpp new file mode 100644 index 0000000..3619ab5 --- /dev/null +++ b/lrdview/MainWindow.cpp @@ -0,0 +1,217 @@ +#include "MainWindow.h" +#include "ui_MainWindow.h" +#include +#include +#include +#include +#include +#include +#include "XmlModel.h" +#include "SettingDialog.h" +#include "lrreportengine.h" + +//#ifndef QT_DEBUG +//Q_IMPORT_PLUGIN(adateeditorplugin) +//#endif + +void centerWindow(QWidget* widget, double widthFactor, double heightFactor) { + QDesktopWidget desk; + int ww = desk.width() * widthFactor; + int wh = desk.height() * heightFactor; + widget->resize(ww, wh); + widget->move((desk.width() - ww) / 2, (desk.height() - wh) / 2); +} + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), + m_previewScene(0), m_isCert(false), m_deleteLastFile(false) +{ + ui->setupUi(this); + m_report.dataManager()->addModel("reportData",&m_model,false); + ui->graphicsView->scale(0.5,0.5); + centerWindow(this, 0.8, 0.8); + m_settings = new QSettings("OCKK Ltd","LRDView"); + m_report.setSettings(m_settings); + readSetting(); + setWindowTitle("LRDView ver 1.30"); + if (QCoreApplication::arguments().count()>1){ + loadReport(QCoreApplication::arguments().at(1)); + } + //ui->statusBar->addWidget(new QLabel(" Designed by Arin Alexander (arin_a@bk.ru) ",this)); +} + +bool isFileExists(QZipReader& reader, QString fileName){ + foreach( QZipReader::FileInfo fi, reader.fileInfoList()){ + if (fi.filePath.compare(fileName)==0) return true; + } + return false; +} +void MainWindow::loadReport(QString fileName){ + if (!fileName.isEmpty()){ + QZipReader reader(fileName); + QByteArray fileData = reader.fileData("report.xml"); + m_report.loadFromByteArray(&fileData); + m_reportData = reader.fileData("data.xml"); + m_model.setXMLData(&m_reportData); + if (m_previewScene) delete m_previewScene; + m_previewScene = dynamic_cast(m_report.createPreviewScene(ui->graphicsView)); + m_previewScene->setItemMode(LimeReport::PreviewMode); + ui->graphicsView->setScene(m_previewScene); + ui->graphicsView->centerOn(0, 0); + ui->actionEdit->setChecked(false); + m_isCert = isFileExists(reader,"CertFlag.sgn"); + //m_lastReport = fileName; + ui->action_PDF->setEnabled(true); + ui->actionPrint->setEnabled(true); + reader.close(); + if (m_deleteLastFile){ + QFile::remove(fileName); + } + } +} + +MainWindow::~MainWindow() +{ + delete m_settings; + delete ui; +} + +void MainWindow::on_actionEdit_triggered() +{ + if (m_previewScene){ + if (m_previewScene->itemMode()==LimeReport::PreviewMode){ + m_previewScene->setItemMode(LimeReport::DesignMode); + } else m_previewScene->setItemMode(LimeReport::PreviewMode); + } +} + +void MainWindow::on_actionOpen_triggered() +{ + QString fileName = QFileDialog::getOpenFileName(0,tr("Открыть файл отчета"),QString(),"*.lrd"); + if (!fileName.isEmpty()){ + loadReport(fileName); + } +} + +void MainWindow::on_actionDesign_triggered() +{ + m_report.designReport(); +} + +void MainWindow::closeEvent(QCloseEvent *event) +{ + writeSetting(); +} + +void MainWindow::writeSetting(){ + m_settings->setValue("geometry",saveGeometry()); +} + +void MainWindow::readSetting() +{ + QVariant v = m_settings->value("geometry"); + if (v.isValid()){ + restoreGeometry(v.toByteArray()); + } + m_certPrinterName = m_settings->value("certPrinterName","").value(); + m_otherPrinterName = m_settings->value("otherPrinterName","").value(); + m_deleteLastFile = m_settings->value("deleteLastFile",false).value(); +} + +void MainWindow::settingAccepted() +{ + m_certPrinterName=((SettingDialog*)sender())->certPrinterName(); + m_otherPrinterName=((SettingDialog*)sender())->othenPrinterName(); + m_deleteLastFile = ((SettingDialog*)sender())->deleteLastFile(); + m_settings->setValue("certPrinterName",m_certPrinterName); + m_settings->setValue("otherPrinterName",m_otherPrinterName); + m_settings->setValue("deleteLastFile",m_deleteLastFile); +} + +void MainWindow::on_actionZoomIn_triggered() +{ + ui->graphicsView->scale(1.2,1.2); +} + +void MainWindow::on_actionZoomOut_triggered() +{ + ui->graphicsView->scale(1/1.2,1/1.2); +} + +void MainWindow::on_actionPrint_triggered() +{ + QPrinterInfo pi; + if (m_isCert) + pi = getPrinterInfo(m_certPrinterName); + else { + pi = getPrinterInfo(m_otherPrinterName); + } + QPrinter printer(pi); + QPrintDialog dialog(&printer,QApplication::activeWindow()); + + + if (dialog.exec()){ + if (m_previewScene->pageItems().isEmpty()) + m_report.printReport(&printer); + else{ + printer.setPrintRange(QPrinter::PrintRange(dialog.printRange())); + printer.setFromTo(dialog.fromPage(), dialog.toPage()); + m_report.printPages( + m_previewScene->pageItems(), &printer + ); + foreach(LimeReport::PageItemDesignIntf::Ptr pageItem, m_previewScene->pageItems()){ + m_previewScene->reactivatePageItem(pageItem); + } + } + } + +} + +QPrinterInfo MainWindow::getPrinterInfo(QString printerName){ + foreach (QPrinterInfo pi, QPrinterInfo::availablePrinters()) { + if (pi.printerName().compare(printerName)==0) + return pi; + } + return QPrinterInfo::defaultPrinter(); +} + +void MainWindow::on_actionSetting_triggered() +{ + SettingDialog w(this); + w.setCertPrinterName(m_certPrinterName); + w.setOtherPrinterName(m_otherPrinterName); + w.setDeleteLastFile(m_deleteLastFile); + connect(&w, SIGNAL(accepted()), this, SLOT(settingAccepted())); + w.exec(); +} + + +void MainWindow::on_actionDelete_triggered() +{ + if (m_previewScene){ + m_previewScene->deleteSelected(); + } +} + +void MainWindow::on_action_PDF_triggered() +{ + QString fileName = QFileDialog::getSaveFileName(this,tr("Имя файла для экспорта"),"","*.pdf" ); + if (!fileName.isEmpty()){ + QPrinter printer; + printer.setOutputFileName(fileName); + printer.setOutputFormat(QPrinter::PdfFormat); + //m_report.printReport(&printer); + if (m_previewScene->pageItems().isEmpty()) + m_report.printReport(&printer); + else{ + m_report.printPages( + m_previewScene->pageItems(), + &printer + ); + foreach(LimeReport::PageItemDesignIntf::Ptr pageItem, m_previewScene->pageItems()){ + m_previewScene->reactivatePageItem(pageItem); + } + } + } +} diff --git a/lrdview/MainWindow.h b/lrdview/MainWindow.h new file mode 100644 index 0000000..31c0e59 --- /dev/null +++ b/lrdview/MainWindow.h @@ -0,0 +1,58 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include "lrreportengine.h" +#include "lrpagedesignintf.h" +#include "XmlModel.h" + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private slots: + void on_actionEdit_triggered(); + void on_actionOpen_triggered(); + void on_actionDesign_triggered(); + void on_actionZoomIn_triggered(); + void on_actionZoomOut_triggered(); + void on_actionPrint_triggered(); + void on_actionSetting_triggered(); + +protected: + void closeEvent(QCloseEvent *event); +private: + void loadReport(QString fileName); + void writeSetting(); + void readSetting(); + QPrinterInfo getPrinterInfo(QString printerName); +private slots: + void settingAccepted(); + void on_actionDelete_triggered(); + + void on_action_PDF_triggered(); + +private: + Ui::MainWindow *ui; + LimeReport::PageDesignIntf* m_previewScene; + LimeReport::ReportEngine m_report; + XmlModel m_model; + QByteArray m_reportData; + QSettings* m_settings; + QString m_certPrinterName; + QString m_otherPrinterName; + bool m_isCert; + bool m_deleteLastFile; + QString m_lastReport; +}; + +#endif // MAINWINDOW_H diff --git a/lrdview/MainWindow.qrc b/lrdview/MainWindow.qrc new file mode 100644 index 0000000..46e191e --- /dev/null +++ b/lrdview/MainWindow.qrc @@ -0,0 +1,17 @@ + + + images/design.png + images/edit.png + images/print.png + images/folder_open_16.png + images/design_black.png + images/edit_page.png + images/edit_pattern.png + images/view.png + images/zoomin.png + images/zoomout.png + images/settings-24.png + images/delete.png + images/PDF1.png + + diff --git a/lrdview/MainWindow.ui b/lrdview/MainWindow.ui new file mode 100644 index 0000000..c81bc44 --- /dev/null +++ b/lrdview/MainWindow.ui @@ -0,0 +1,211 @@ + + + MainWindow + + + + 0 + 0 + 694 + 677 + + + + LRDView + + + + :/images/view.png:/images/view.png + + + + + + + + 2 + + + + + + + + + + 0 + 0 + 694 + 21 + + + + + + true + + + + 16 + 16 + + + + TopToolBarArea + + + false + + + + + + + + + + + + + + + + + + false + + + + :/images/print.png:/images/print.png + + + Печать + + + Печать документа + + + Ctrl+P + + + + + true + + + + :/images/edit.png:/images/edit.png + + + Редактировать + + + Редактировать + + + Ctrl+E + + + + + + :/images/folder_open_16.png:/images/folder_open_16.png + + + Открыть + + + Открыть файл + + + Ctrl+O + + + + + + :/images/edit_pattern.png:/images/edit_pattern.png + + + Редактировать шаблон + + + Редактировть шаблон + + + + + + :/images/zoomin.png:/images/zoomin.png + + + Увеличить + + + Увеличить + + + Ctrl+= + + + + + + :/images/zoomout.png:/images/zoomout.png + + + Уменьшить + + + Уменьшить + + + Ctrl+- + + + + + + :/images/settings-24.png:/images/settings-24.png + + + Настройки + + + Настройки + + + + + + :/images/delete.png:/images/delete.png + + + Удалить + + + Удалить выбранный элемент + + + Del + + + + + false + + + + :/images/PDF1.png:/images/PDF1.png + + + Экспорт в PDF + + + + + + + + + diff --git a/lrdview/SettingDialog.cpp b/lrdview/SettingDialog.cpp new file mode 100644 index 0000000..ee842c1 --- /dev/null +++ b/lrdview/SettingDialog.cpp @@ -0,0 +1,53 @@ +#include "SettingDialog.h" +#include "ui_SettingDialog.h" +#include + +SettingDialog::SettingDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::SettingDialog) +{ + ui->setupUi(this); + initPrinters(); +} + +SettingDialog::~SettingDialog() +{ + delete ui; +} + +void SettingDialog::initPrinters() +{ + foreach (QPrinterInfo pi, QPrinterInfo::availablePrinters()) { + ui->certPrinter->addItem(pi.printerName()); + ui->otherPrinter->addItem(pi.printerName()); + } +} + +void SettingDialog::setCertPrinterName(QString printerName){ + + ui->certPrinter->setCurrentIndex(ui->certPrinter->findText(printerName)); +} + +void SettingDialog::setOtherPrinterName(QString printerName) +{ + ui->otherPrinter->setCurrentIndex(ui->otherPrinter->findText(printerName)); +} + +QString SettingDialog::certPrinterName(){ + return ui->certPrinter->currentText(); +} + +QString SettingDialog::othenPrinterName() +{ + return ui->otherPrinter->currentText(); +} + +bool SettingDialog::deleteLastFile(){ + return ui->checkBox->isChecked(); +} + +void SettingDialog::setDeleteLastFile(bool value) +{ + ui->checkBox->setChecked(value); +} + diff --git a/lrdview/SettingDialog.h b/lrdview/SettingDialog.h new file mode 100644 index 0000000..b9eaa5b --- /dev/null +++ b/lrdview/SettingDialog.h @@ -0,0 +1,30 @@ +#ifndef SETTINGDIALOG_H +#define SETTINGDIALOG_H + +#include + +namespace Ui { +class SettingDialog; +} + +class SettingDialog : public QDialog +{ + Q_OBJECT + +public: + explicit SettingDialog(QWidget *parent = 0); + ~SettingDialog(); + void setCertPrinterName(QString printerName); + void setOtherPrinterName(QString printerName); + QString certPrinterName(); + QString othenPrinterName(); + bool deleteLastFile(); + void setDeleteLastFile(bool value); +private: + void initPrinters(); + +private: + Ui::SettingDialog *ui; +}; + +#endif // SETTINGDIALOG_H diff --git a/lrdview/SettingDialog.ui b/lrdview/SettingDialog.ui new file mode 100644 index 0000000..ff34f08 --- /dev/null +++ b/lrdview/SettingDialog.ui @@ -0,0 +1,114 @@ + + + SettingDialog + + + Qt::WindowModal + + + + 0 + 0 + 400 + 151 + + + + Настройки + + + true + + + + + + Принтер + + + + + + + + Сертификаты + + + + + + + + + + + + + + Остальное + + + + + + + + + + + + + + + Удалять файл + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + SettingDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SettingDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/lrdview/XmlModel.cpp b/lrdview/XmlModel.cpp new file mode 100644 index 0000000..9942120 --- /dev/null +++ b/lrdview/XmlModel.cpp @@ -0,0 +1,73 @@ +#include "XmlModel.h" +#include + +XmlModel::XmlModel(QByteArray *data) { + if (data) { + m_doc.setContent(*data); + initModel(); + } +} + +void XmlModel::setXMLData(QByteArray *data) { + if (data) { + beginResetModel(); + m_doc.setContent(*data); + initModel(); + endResetModel(); + } +} + +void XmlModel::initModel(){ + m_items = m_doc.firstChildElement("items"); + parseHeaders(); +} + +void XmlModel::parseHeaders() +{ + m_fields.clear(); + QDomNode root = m_doc.firstChildElement("items"); + QDomNode item = root.firstChild(); + for (int i=0; i +#include +#include + +class XmlModel : public QAbstractItemModel +{ +public: + XmlModel(QByteArray* data = 0); + void setXMLData(QByteArray* data); + void parseHeaders(); + QModelIndex index(int row, int column, const QModelIndex &parent) const; + QModelIndex parent(const QModelIndex &child) const; + int rowCount(const QModelIndex &parent) const; + int columnCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; +private: + void initModel(); +private: + QDomDocument m_doc; + QDomNode m_items; + QVector m_fields; +}; + +#endif // XMLMODEL_H diff --git a/lrdview/images/PDF1.png b/lrdview/images/PDF1.png new file mode 100644 index 0000000..284dcee Binary files /dev/null and b/lrdview/images/PDF1.png differ diff --git a/lrdview/images/delete.png b/lrdview/images/delete.png new file mode 100644 index 0000000..148f047 Binary files /dev/null and b/lrdview/images/delete.png differ diff --git a/lrdview/images/design.png b/lrdview/images/design.png new file mode 100644 index 0000000..d2ecf05 Binary files /dev/null and b/lrdview/images/design.png differ diff --git a/lrdview/images/design_black.png b/lrdview/images/design_black.png new file mode 100644 index 0000000..3820adc Binary files /dev/null and b/lrdview/images/design_black.png differ diff --git a/lrdview/images/edit.png b/lrdview/images/edit.png new file mode 100644 index 0000000..1a46331 Binary files /dev/null and b/lrdview/images/edit.png differ diff --git a/lrdview/images/edit_page.png b/lrdview/images/edit_page.png new file mode 100644 index 0000000..b830886 Binary files /dev/null and b/lrdview/images/edit_page.png differ diff --git a/lrdview/images/edit_pattern.png b/lrdview/images/edit_pattern.png new file mode 100644 index 0000000..17c2114 Binary files /dev/null and b/lrdview/images/edit_pattern.png differ diff --git a/lrdview/images/folder_open.png b/lrdview/images/folder_open.png new file mode 100644 index 0000000..4c03fdd Binary files /dev/null and b/lrdview/images/folder_open.png differ diff --git a/lrdview/images/folder_open_16.png b/lrdview/images/folder_open_16.png new file mode 100644 index 0000000..1d2e71c Binary files /dev/null and b/lrdview/images/folder_open_16.png differ diff --git a/lrdview/images/print.png b/lrdview/images/print.png new file mode 100644 index 0000000..db008e2 Binary files /dev/null and b/lrdview/images/print.png differ diff --git a/lrdview/images/settings-24.png b/lrdview/images/settings-24.png new file mode 100644 index 0000000..1eafc53 Binary files /dev/null and b/lrdview/images/settings-24.png differ diff --git a/lrdview/images/view.ico b/lrdview/images/view.ico new file mode 100644 index 0000000..343474a Binary files /dev/null and b/lrdview/images/view.ico differ diff --git a/lrdview/images/view.png b/lrdview/images/view.png new file mode 100644 index 0000000..a23184f Binary files /dev/null and b/lrdview/images/view.png differ diff --git a/lrdview/images/zoomin.png b/lrdview/images/zoomin.png new file mode 100644 index 0000000..0229b6f Binary files /dev/null and b/lrdview/images/zoomin.png differ diff --git a/lrdview/images/zoomout.png b/lrdview/images/zoomout.png new file mode 100644 index 0000000..aa53d25 Binary files /dev/null and b/lrdview/images/zoomout.png differ diff --git a/lrdview/lrdview.pro b/lrdview/lrdview.pro new file mode 100644 index 0000000..df434d3 --- /dev/null +++ b/lrdview/lrdview.pro @@ -0,0 +1,43 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-03-24T20:29:50 +# +#------------------------------------------------- + +QT += core gui xml +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets gui-private + +CONFIG += uitools + +include(../common.pri) +include(../qzint.pri) +include(../limereport.pri) + +TARGET = lrdview +TEMPLATE = app + +win32 { + RC_FILE += mainicon.rc +} + +SOURCES += main.cpp\ + MainWindow.cpp \ + XmlModel.cpp \ + SettingDialog.cpp + +HEADERS += MainWindow.h \ + XmlModel.h \ + SettingDialog.h + +FORMS += MainWindow.ui \ + SettingDialog.ui + +RESOURCES += \ + MainWindow.qrc + +#win32:CONFIG(release, debug|release): { +# LIBS += -LD:/Work/C++/Projects/LRDView/libs -ladateeditorplugin +# QTPLUGIN += adateeditorplugin +# DEFINES += DEBUG +#} + diff --git a/lrdview/main.cpp b/lrdview/main.cpp new file mode 100644 index 0000000..da3fe56 --- /dev/null +++ b/lrdview/main.cpp @@ -0,0 +1,12 @@ +#include "MainWindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + //QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/lrdview/mainicon.rc b/lrdview/mainicon.rc new file mode 100644 index 0000000..790ecd0 --- /dev/null +++ b/lrdview/mainicon.rc @@ -0,0 +1 @@ +DI_ICON1 ICON "view.ico" diff --git a/lrdview/view.ico b/lrdview/view.ico new file mode 100644 index 0000000..343474a Binary files /dev/null and b/lrdview/view.ico differ