From ebbf2b7beb420b2d8154541d991d9d9a687dc2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82=D0=B8?= =?UTF-8?q?=D0=BD=20=D0=9C=D0=B0=D0=BA=D0=B0=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= Date: Wed, 12 Mar 2025 14:30:56 +0300 Subject: [PATCH 1/4] Fixed build issues Fixed build with cmake when including limereport as a submodule with add_subdirectory(...) Removed unnecessary checks of ENABLE DIALOG DESIGNER in CMakeLists.txt Fixed Qt 5.15.16 incompatibility Added missing LIMEREPORT_EXPORT Fixed warnings --- CMakeLists.txt | 13 +++------ cmake/modules/GenerateVersionHeader.cmake | 6 ++-- .../designerintegrationv2/sizehandlerect.cpp | 6 +++- limereport/items/lralignpropitem.h | 2 +- limereport/items/lrborderframeeditor.cpp | 17 ++++++++--- limereport/items/lrchartitem.cpp | 14 +++++----- limereport/lrbasedesignintf.cpp | 8 +++--- limereport/lrdatasourcemanager.h | 2 +- limereport/lritemdesignintf.h | 4 +-- limereport/lrpreviewreportwindow.cpp | 2 +- limereport/lrreportdesignwindow.cpp | 28 +++++++++---------- .../editors/lrcomboboxeditor.h | 3 +- limereport/objectinspector/lrobjectpropitem.h | 2 +- limereport/serializators/lrxmlwriter.cpp | 6 ++-- .../translationeditor/translationeditor.cpp | 2 +- 15 files changed, 62 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1edeca..f01ad04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,13 +35,9 @@ if(HAVE_UI_LOADER) if(ENABLE_DIALOG_DESIGNER) if(USE_QT6) - if(ENABLE_DIALOG_DESIGNER) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponentsPrivate REQUIRED) - endif() + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponentsPrivate REQUIRED) else() - if(ENABLE_DIALOG_DESIGNER) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponents REQUIRED) - endif() + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponents REQUIRED) endif(USE_QT6) endif() @@ -397,7 +393,7 @@ set(GLOBAL_HEADERS ${PROJECT_NAME}/LRCallbackDS ${PROJECT_NAME}/LRDataManager ${PROJECT_NAME}/LRScriptManager - ${CMAKE_BINARY_DIR}/limereport/version.h + ${CMAKE_CURRENT_BINARY_DIR}/limereport/version.h ) set(PROJECT_NAME ${PROJECT_NAME}-qt${QT_VERSION_MAJOR}) @@ -470,7 +466,7 @@ target_include_directories( ${PROJECT_NAME} PRIVATE limereport/scripteditor ) target_include_directories( ${PROJECT_NAME} PUBLIC - ${CMAKE_BINARY_DIR}/limereport ) + ${CMAKE_CURRENT_BINARY_DIR}/limereport ) target_include_directories( ${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -484,4 +480,3 @@ install(TARGETS LIBRARY DESTINATION lib RUNTIME DESTINATION bin PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/limereport) - diff --git a/cmake/modules/GenerateVersionHeader.cmake b/cmake/modules/GenerateVersionHeader.cmake index ed62702..a7ddd51 100644 --- a/cmake/modules/GenerateVersionHeader.cmake +++ b/cmake/modules/GenerateVersionHeader.cmake @@ -4,7 +4,7 @@ if(GIT_EXECUTABLE) # Generate a git-describe version string from Git repository tags execute_process( COMMAND ${GIT_EXECUTABLE} describe --tags --dirty - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GIT_DESCRIBE_VERSION RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE OUTPUT_STRIP_TRAILING_WHITESPACE @@ -22,7 +22,7 @@ if(NOT DEFINED GIT_VERSION) endif() configure_file( - ${CMAKE_SOURCE_DIR}/limereport/version.h.in - ${CMAKE_BINARY_DIR}/limereport/version.h + ${CMAKE_CURRENT_SOURCE_DIR}/limereport/version.h.in + ${CMAKE_CURRENT_BINARY_DIR}/limereport/version.h @ONLY) diff --git a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp index 78d2748..5999d30 100644 --- a/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp +++ b/limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp @@ -103,7 +103,7 @@ void SizeHandleRect::mousePressEvent(QMouseEvent *e) return; m_startSize = m_curSize = m_resizable->size(); -#if QT_VERSION < QT_VERSION_CHECK(5,15,3) +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPos()); #else m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPosition()); @@ -121,7 +121,11 @@ void SizeHandleRect::mouseMoveEvent(QMouseEvent *e) // causes the handle and the mouse cursor to become out of sync // once a min/maxSize limit is hit. When the cursor reenters the valid // areas, it will now snap to it. +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) m_curPos = m_resizable->mapFromGlobal(e->globalPos()); +#else + m_curPos = m_resizable->mapFromGlobal(e->globalPosition()); +#endif QSize delta = QSize(m_curPos.x() - m_startPos.x(), m_curPos.y() - m_startPos.y()); switch (m_dir) { case Right: diff --git a/limereport/items/lralignpropitem.h b/limereport/items/lralignpropitem.h index 8bf7a8b..7a7bc60 100644 --- a/limereport/items/lralignpropitem.h +++ b/limereport/items/lralignpropitem.h @@ -39,7 +39,7 @@ typedef QMap AlignMap; class AlignmentItemEditor; -class AlignmentPropItem: public ObjectPropItem { +class LIMEREPORT_EXPORT AlignmentPropItem: public ObjectPropItem { Q_OBJECT public: AlignmentPropItem(): ObjectPropItem(), m_horizEditor(NULL), m_vertEditor(NULL) { } diff --git a/limereport/items/lrborderframeeditor.cpp b/limereport/items/lrborderframeeditor.cpp index d3f99e0..a4acfd9 100644 --- a/limereport/items/lrborderframeeditor.cpp +++ b/limereport/items/lrborderframeeditor.cpp @@ -94,16 +94,24 @@ void BorderFrameEditor::unSetAllLines() void BorderFrameEditor::mousePressEvent(QMouseEvent* event) { - if (event->x() >= 10 && event->y() < 30) +#if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) + int x = event->x(); + int y = event->y(); +#else + int x = event->position().x(); + int y = event->position().y(); +#endif + + if (x >= 10 && y < 30) emit borderSideClicked(BaseDesignIntf::BorderSide::TopLine, !topLine); - if ((event->x() >= 10 && event->x() < 30) && (event->y() > 10)) + if ((x >= 10 && x < 30) && (y > 10)) emit borderSideClicked(BaseDesignIntf::BorderSide::LeftLine, !leftLine); - if (event->x() >= 10 && (event->y() > 80 && event->y() < rect().bottom())) + if (x >= 10 && (y > 80 && y < rect().bottom())) emit borderSideClicked(BaseDesignIntf::BorderSide::BottomLine, !bottomLine); - if ((event->x() >= 130 && event->x() < rect().width()) && event->y() > 10) + if ((x >= 130 && x < rect().width()) && y > 10) emit borderSideClicked(BaseDesignIntf::BorderSide::RightLine, !rightLine); } @@ -172,6 +180,7 @@ QGraphicsLineItem* BorderFrameEditor::createSideLine(LimeReport::BaseDesignIntf: return scene->addLine( QLineF(10, rect().bottom() - 10, rect().width() - 10, rect().bottom() - 10), m_pen); } + return nullptr; } void BorderFrameEditor::updateBorders() diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index d6af54c..d8818b4 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -770,26 +770,26 @@ QSizeF AbstractSeriesChart::calcChartLegendSize(const QFont& font, const qreal m } default: { qreal cw = 0; - qreal maxWidth = 0; + qreal mw = 0; if (m_chartItem->series().isEmpty()) { foreach (QString label, m_designLabels) { cw += fm.height(); - if (maxWidth < fm.boundingRect(label).width()) - maxWidth = fm.boundingRect(label).width() + 10; + if (mw < fm.boundingRect(label).width()) + mw = fm.boundingRect(label).width() + 10; } } else { foreach (SeriesItem* series, m_chartItem->series()) { cw += fm.height(); - if (maxWidth < fm.boundingRect(series->name()).width()) - maxWidth = fm.boundingRect(series->name()).width() + 10; + if (mw < fm.boundingRect(series->name()).width()) + mw = fm.boundingRect(series->name()).width() + 10; } } cw += fm.height(); - return QSizeF(maxWidth + fm.height() * 2, cw); + return QSizeF(mw + fm.height() * 2, cw); } } - return QSizeF(); + } bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect) diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 80741e1..ef67260 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1354,10 +1354,10 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent* event) pasteAction->setEnabled(false); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L)); - copyAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C)); - cutAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X)); - pasteAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V)); + lockGeometryAction->setShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_L)); + copyAction->setShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_C)); + cutAction->setShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_X)); + pasteAction->setShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_V)); #else lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); diff --git a/limereport/lrdatasourcemanager.h b/limereport/lrdatasourcemanager.h index e57fd8e..3485274 100644 --- a/limereport/lrdatasourcemanager.h +++ b/limereport/lrdatasourcemanager.h @@ -112,7 +112,7 @@ private: DataNode* m_rootNode; }; -class DataSourceManager: +class LIMEREPORT_EXPORT DataSourceManager: public QObject, public ICollectionContainer, public IVariablesContainer, diff --git a/limereport/lritemdesignintf.h b/limereport/lritemdesignintf.h index 9a5bddf..2b8b703 100644 --- a/limereport/lritemdesignintf.h +++ b/limereport/lritemdesignintf.h @@ -36,7 +36,7 @@ namespace LimeReport { class BaseDesignIntf; -class ItemDesignIntf: public BaseDesignIntf { +class LIMEREPORT_EXPORT ItemDesignIntf: public BaseDesignIntf { Q_OBJECT Q_PROPERTY(LocationType itemLocation READ itemLocation WRITE setItemLocation) Q_PROPERTY(bool stretchToMaxHeight READ stretchToMaxHeight WRITE setStretchToMaxHeight) @@ -81,7 +81,7 @@ protected: } }; -class ContentItemDesignIntf: public ItemDesignIntf { +class LIMEREPORT_EXPORT ContentItemDesignIntf: public ItemDesignIntf { Q_OBJECT public: ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0, diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 94687d8..34c7c19 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -465,7 +465,7 @@ void PreviewReportWindow::scaleComboboxChanged(QString text) if (m_scalePercentChanging) return; m_scalePercentChanging = true; - m_previewReportWidget->setScalePercent(text.remove(text.count() - 1, 1).toInt()); + m_previewReportWidget->setScalePercent(text.remove(text.length() - 1, 1).toInt()); m_scalePercentChanging = false; } diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index a0501f7..bdcdf65 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -162,7 +162,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::Key(Qt::CTRL) | Qt::Key_N)); connect(m_newReportAction, SIGNAL(triggered()), this, SLOT(slotNewReport())); m_newPageAction = new QAction(tr("New Report Page"), this); @@ -184,7 +184,7 @@ 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::Key(Qt::CTRL) | Qt::Key_Z)); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(slotUndo())); m_redoAction = new QAction(tr("Redo"), this); @@ -195,17 +195,17 @@ void ReportDesignWindow::createActions() 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::Key(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::Key(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::Key(Qt::CTRL) | Qt::Key_X)); connect(m_cutAction, SIGNAL(triggered()), this, SLOT(slotCut())); m_settingsAction = new QAction(tr("Settings"), this); @@ -215,13 +215,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::Key(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::Key(Qt::CTRL) | Qt::Key_M)); connect(m_useMagnetAction, SIGNAL(toggled(bool)), this, SLOT(slotUseMagnet(bool))); m_newTextItemAction = new QAction(tr("Text Item"), this); @@ -231,7 +231,7 @@ 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::Key(Qt::CTRL) | Qt::Key_S)); connect(m_saveReportAction, SIGNAL(triggered()), this, SLOT(slotSaveReport())); m_saveReportAsAction = new QAction(tr("Save Report As"), this); @@ -241,7 +241,7 @@ void ReportDesignWindow::createActions() 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::Key(Qt::CTRL) | Qt::Key_O)); connect(m_loadReportAction, SIGNAL(triggered()), this, SLOT(slotLoadReport())); m_deleteItemAction = new QAction(tr("Delete item"), this); @@ -259,7 +259,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::Key(Qt::CTRL) | Qt::Key_P)); connect(m_previewReportAction, SIGNAL(triggered()), this, SLOT(slotPreviewReport())); m_testAction = new QAction("test", this); @@ -286,13 +286,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::Key(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::Key(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); @@ -306,7 +306,7 @@ 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::Key(Qt::CTRL) | Qt::Key_L)); connect(m_lockSelectedItemsAction, SIGNAL(triggered()), this, SLOT(slotLockSelectedItems())); m_unlockSelectedItemsAction = new QAction(tr("Unlock selected items"), this); @@ -317,7 +317,7 @@ void ReportDesignWindow::createActions() 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::Key(Qt::CTRL) | Qt::Key_A)); connect(m_selectOneLevelItems, SIGNAL(triggered()), this, SLOT(slotSelectOneLevelItems())); } diff --git a/limereport/objectinspector/editors/lrcomboboxeditor.h b/limereport/objectinspector/editors/lrcomboboxeditor.h index 1c45f94..73bc675 100644 --- a/limereport/objectinspector/editors/lrcomboboxeditor.h +++ b/limereport/objectinspector/editors/lrcomboboxeditor.h @@ -33,6 +33,7 @@ #include #include //#include +#include "lrglobal.h" class QToolButton; @@ -58,7 +59,7 @@ private: bool m_popup; }; -class ComboBoxEditor: public QWidget { +class LIMEREPORT_EXPORT ComboBoxEditor: public QWidget { Q_OBJECT public: // explicit ComboBoxEditor(QWidget *parent = 0); diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index 650ca24..2a028d6 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -42,7 +42,7 @@ namespace LimeReport { -class ObjectPropItem: public QObject { +class LIMEREPORT_EXPORT ObjectPropItem: public QObject { Q_OBJECT public: diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 1debc5b..bf0bad2 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -250,9 +250,9 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement foreach (PageTranslation* page, curTranslation->pagesTranslation()) { QDomElement pageNode = m_doc->createElement(page->pageName); languageNode.appendChild(pageNode); - foreach (ItemTranslation* item, page->itemsTranslation) { - QDomElement itemNode = m_doc->createElement(item->itemName); - foreach (PropertyTranslation* property, item->propertyesTranslation) { + foreach (ItemTranslation* translationItem, page->itemsTranslation) { + QDomElement itemNode = m_doc->createElement(translationItem->itemName); + foreach (PropertyTranslation* property, translationItem->propertyesTranslation) { if (property->sourceValue.compare(property->value) != 0) { QDomElement propertyNode = m_doc->createElement(property->propertyName); propertyNode.setAttribute("Value", property->value); diff --git a/limereport/translationeditor/translationeditor.cpp b/limereport/translationeditor/translationeditor.cpp index c31ee0d..1e0eb81 100644 --- a/limereport/translationeditor/translationeditor.cpp +++ b/limereport/translationeditor/translationeditor.cpp @@ -36,7 +36,7 @@ TranslationEditor::TranslationEditor(QWidget* parent): ui->tbStrings->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("Source text"))); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) m_clrReturn - = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return), this, SLOT(slotItemChecked())); + = new QShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_Return), this, SLOT(slotItemChecked())); #else m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked())); From 5041cca47b380f9758d30b4e56663eb2fbcc6344 Mon Sep 17 00:00:00 2001 From: Konstantin Makarenkov Date: Sun, 16 Mar 2025 18:04:23 +0300 Subject: [PATCH 2/4] Added translation updating --- CMakeLists.txt | 74 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f01ad04..3152c82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ option(LIMEREPORT_DEMO "Build LimeReport demos" OFF) option(ENABLE_DIALOG_DESIGNER "Enable dialog designer" OFF) option(HAVE_UI_LOADER "Enable ui loader" OFF) option(USE_QT6 "Use Qt6" OFF) +option(LIMEREPORT_TRANSLATIONS "Update LimeReport TS files" OFF) if (ENABLE_DIALOG_DESIGNER AND NOT HAVE_UI_LOADER) message(FATAL_ERROR "You need to enable HAVE_UI_LOADER") @@ -451,10 +452,15 @@ if(ENABLE_ZINT) target_link_libraries( ${PROJECT_NAME} PRIVATE QZint) endif(ENABLE_ZINT) -target_compile_definitions( ${PROJECT_NAME} PRIVATE -DDEFAULT_ITEM_PADDING=${DEFAULT_ITEM_PADDING} -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS) +target_compile_definitions( ${PROJECT_NAME} PRIVATE + -DDEFAULT_ITEM_PADDING=${DEFAULT_ITEM_PADDING} + -DHAVE_QT${QT_VERSION_MAJOR} + -DHAVE_REPORT_DESIGNER + -DUSE_QJSENGINE + -D_CRT_SECURE_NO_WARNINGS) target_include_directories( ${PROJECT_NAME} PRIVATE - limereport/ + limereport/ limereport/base limereport/bands limereport/databrowser @@ -474,6 +480,70 @@ target_include_directories( ${PROJECT_NAME} INTERFACE list (APPEND GLOBAL_HEADERS ${EXTRA_FILES}) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${GLOBAL_HEADERS}") + +message(STATUS "LIMEREPORT_TRANSLATIONS: ${LIMEREPORT_TRANSLATIONS}") +list(APPEND LANGUAGES ru es fr pl zh ar) +foreach(lang ${LANGUAGES}) + list(APPEND TS_FILES translations/limereport_${lang}.ts) +endforeach() + +if (${QT_VERSION} GREATER_EQUAL 6.7.0) + + qt_add_lrelease( + TS_FILES ${TS_FILES} + EXCLUDE_FROM_ALL + LRELEASE_TARGET ${PROJECT_NAME}_lrelease + OPTIONS -removeidentical + ) + + if (LIMEREPORT_TRANSLATIONS) + qt_add_lupdate( + TS_FILES ${TS_FILES} + SOURCES ${LIMEREPORT_SOURCES} + LUPDATE_TARGET ${PROJECT_NAME}_lupdate + OPTIONS -noobsolete + ) + add_dependencies(${PROJECT_NAME}_lrelease ${PROJECT_NAME}_lupdate) + endif() + +elseif (${QT_VERSION} GREATER_EQUAL 6.2.0) + + qt_add_lrelease( + ${PROJECT_NAME} + TS_FILES ${TS_FILES} + OPTIONS -removeidentical + ) + + if (LIMEREPORT_TRANSLATIONS) + qt_add_lupdate( + ${PROJECT_NAME} + TS_FILES ${TS_FILES} + SOURCES ${LIMEREPORT_SOURCES} + OPTIONS -noobsolete + ) + add_dependencies(${PROJECT_NAME}_lrelease ${PROJECT_NAME}_lupdate) + endif() + +else() + + if (LIMEREPORT_TRANSLATIONS) + qt5_create_translation( + QM_FILES + ${LIMEREPORT_SOURCES} + ${TS_FILES} + OPTIONS -noobsolete -locations relative + ) + else() + qt5_add_translation(QM_FILES ${TS_FILES} OPTIONS -removeidentical) + endif() + + add_custom_target(${PROJECT_NAME}_lrelease DEPENDS ${QM_FILES}) + +endif() + +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_lrelease) + + install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib From b38a5e6e6303066e573f32ac88a86d319bbb71eb Mon Sep 17 00:00:00 2001 From: Konstantin Makarenkov Date: Wed, 19 Mar 2025 00:37:21 +0300 Subject: [PATCH 3/4] Changed translation option name --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3152c82..9554585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ option(LIMEREPORT_DEMO "Build LimeReport demos" OFF) option(ENABLE_DIALOG_DESIGNER "Enable dialog designer" OFF) option(HAVE_UI_LOADER "Enable ui loader" OFF) option(USE_QT6 "Use Qt6" OFF) -option(LIMEREPORT_TRANSLATIONS "Update LimeReport TS files" OFF) +option(UPDATE_TRANSLATIONS "Update TS files" OFF) if (ENABLE_DIALOG_DESIGNER AND NOT HAVE_UI_LOADER) message(FATAL_ERROR "You need to enable HAVE_UI_LOADER") @@ -481,7 +481,7 @@ list (APPEND GLOBAL_HEADERS ${EXTRA_FILES}) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${GLOBAL_HEADERS}") -message(STATUS "LIMEREPORT_TRANSLATIONS: ${LIMEREPORT_TRANSLATIONS}") +message(STATUS "${PROJECT_NAME} UPDATE_TRANSLATIONS: ${UPDATE_TRANSLATIONS}") list(APPEND LANGUAGES ru es fr pl zh ar) foreach(lang ${LANGUAGES}) list(APPEND TS_FILES translations/limereport_${lang}.ts) @@ -496,7 +496,7 @@ if (${QT_VERSION} GREATER_EQUAL 6.7.0) OPTIONS -removeidentical ) - if (LIMEREPORT_TRANSLATIONS) + if (UPDATE_TRANSLATIONS) qt_add_lupdate( TS_FILES ${TS_FILES} SOURCES ${LIMEREPORT_SOURCES} @@ -514,7 +514,7 @@ elseif (${QT_VERSION} GREATER_EQUAL 6.2.0) OPTIONS -removeidentical ) - if (LIMEREPORT_TRANSLATIONS) + if (UPDATE_TRANSLATIONS) qt_add_lupdate( ${PROJECT_NAME} TS_FILES ${TS_FILES} @@ -526,7 +526,7 @@ elseif (${QT_VERSION} GREATER_EQUAL 6.2.0) else() - if (LIMEREPORT_TRANSLATIONS) + if (UPDATE_TRANSLATIONS) qt5_create_translation( QM_FILES ${LIMEREPORT_SOURCES} From c7e4028637f69a12515d386d252b49d026720818 Mon Sep 17 00:00:00 2001 From: Konstantin Makarenkov Date: Thu, 20 Mar 2025 11:12:46 +0300 Subject: [PATCH 4/4] Fixed code style --- limereport/items/lrborderframeeditor.cpp | 2 +- limereport/items/lrchartitem.cpp | 1 - limereport/serializators/lrxmlwriter.cpp | 3 ++- limereport/translationeditor/translationeditor.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/limereport/items/lrborderframeeditor.cpp b/limereport/items/lrborderframeeditor.cpp index a4acfd9..e3aa525 100644 --- a/limereport/items/lrborderframeeditor.cpp +++ b/limereport/items/lrborderframeeditor.cpp @@ -94,7 +94,7 @@ void BorderFrameEditor::unSetAllLines() void BorderFrameEditor::mousePressEvent(QMouseEvent* event) { -#if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) int x = event->x(); int y = event->y(); #else diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index d8818b4..4e30d15 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -789,7 +789,6 @@ QSizeF AbstractSeriesChart::calcChartLegendSize(const QFont& font, const qreal m return QSizeF(mw + fm.height() * 2, cw); } } - } bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect) diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index bf0bad2..10fcddb 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -252,7 +252,8 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement languageNode.appendChild(pageNode); foreach (ItemTranslation* translationItem, page->itemsTranslation) { QDomElement itemNode = m_doc->createElement(translationItem->itemName); - foreach (PropertyTranslation* property, translationItem->propertyesTranslation) { + foreach (PropertyTranslation* property, + translationItem->propertyesTranslation) { if (property->sourceValue.compare(property->value) != 0) { QDomElement propertyNode = m_doc->createElement(property->propertyName); propertyNode.setAttribute("Value", property->value); diff --git a/limereport/translationeditor/translationeditor.cpp b/limereport/translationeditor/translationeditor.cpp index 1e0eb81..c012ff4 100644 --- a/limereport/translationeditor/translationeditor.cpp +++ b/limereport/translationeditor/translationeditor.cpp @@ -35,8 +35,8 @@ TranslationEditor::TranslationEditor(QWidget* parent): ui->tbStrings->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Property"))); ui->tbStrings->setHorizontalHeaderItem(3, new QTableWidgetItem(tr("Source text"))); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - m_clrReturn - = new QShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_Return), this, SLOT(slotItemChecked())); + m_clrReturn = new QShortcut(QKeySequence(Qt::Key(Qt::CTRL) | Qt::Key_Return), this, + SLOT(slotItemChecked())); #else m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked()));