diff --git a/CMakeLists.txt b/CMakeLists.txt index fb10889..00f0869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) set(LIMEREPORT_VERSION_MAJOR 1) set(LIMEREPORT_VERSION_MINOR 6) -set(LIMEREPORT_VERSION_RELEASE 7) +set(LIMEREPORT_VERSION_RELEASE 8) option(ENABLE_ZINT "Enable libzint build for barcode support" OFF) option(LIMEREPORT_STATIC "Build LimeReport as static library" OFF) @@ -38,7 +38,7 @@ endif() add_subdirectory(3rdparty) add_subdirectory(designer EXCLUDE_FROM_ALL) -add_subdirectory(demo_r1 EXCLUDE_FROM_ALL) +add_subdirectory(demo_r1 EXCLUDE_FROM_ALL) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) diff --git a/common.pri b/common.pri index bbdb45d..160fdce 100644 --- a/common.pri +++ b/common.pri @@ -141,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 6 -LIMEREPORT_VERSION_RELEASE = 7 +LIMEREPORT_VERSION_RELEASE = 8 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/items/lrimageitem.cpp b/limereport/items/lrimageitem.cpp index 02f7daa..8fc3975 100644 --- a/limereport/items/lrimageitem.cpp +++ b/limereport/items/lrimageitem.cpp @@ -61,8 +61,13 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par } void ImageItem::loadPictureFromVariant(QVariant& data){ + //TODO: Migrate to QMetaType if (data.isValid()){ - if (data.type()==QVariant::Image){ +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + if (data.typeId() == QMetaType::QImage){ +#else + if (data.type() == QVariant::Image){ +#endif m_picture = data.value(); } else { switch (m_format) { @@ -178,11 +183,22 @@ void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, m_resourcePath = expandDataFields(m_resourcePath, NoEscapeSymbols, dataManager); m_picture = QImage(m_resourcePath); } else if (!m_variable.isEmpty()){ + //TODO: Migrate to QMetaType QVariant data = dataManager->variable(m_variable); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + if (data.typeId() == QMetaType::QString){ +#else if (data.type() == QVariant::String){ +#endif m_picture = QImage(data.toString()); - } else if (data.type() == QVariant::Image){ - loadPictureFromVariant(data); + } else { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + if (data.typeId() == QMetaType::QImage){ +#else + if (data.type() == QVariant::Image){ +#endif + loadPictureFromVariant(data); + } } } } diff --git a/limereport/items/lrsvgitem.cpp b/limereport/items/lrsvgitem.cpp index fe3c1a1..9bf1ea6 100644 --- a/limereport/items/lrsvgitem.cpp +++ b/limereport/items/lrsvgitem.cpp @@ -107,11 +107,22 @@ void SVGItem::updateItemSize(DataSourceManager *dataManager, RenderPass pass, in m_resourcePath = expandDataFields(m_resourcePath, NoEscapeSymbols, dataManager); m_image = imageFromResource(m_resourcePath); } else if (!m_variable.isEmpty()){ + //TODO: Migrate to QMetaType QVariant data = dataManager->variable(m_variable); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (data.typeId() == QMetaType::QString){ +#else if (data.type() == QVariant::String){ +#endif m_image = imageFromResource(data.toString()); - } else if (data.type() == QVariant::ByteArray) { - m_image = data.value() ; + } else { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + if (data.typeId() == QMetaType::QByteArray) { +#else + if (data.type() == QVariant::ByteArray) { +#endif + m_image = data.value() ; + } } } } diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 73b9dfd..fb14eb6 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -487,6 +487,7 @@ QString TextItem::formatFieldValue() } } +#if QT_VERSION < QT_VERSION_CHECK(6,0,0) switch (value.type()) { case QVariant::Date: case QVariant::DateTime: @@ -496,6 +497,17 @@ QString TextItem::formatFieldValue() default: return value.toString(); } +#else + switch (value.typeId()) { + case QMetaType::QDate: + case QMetaType::QDateTime: + return formatDateTime(value.toDateTime()); + case QMetaType::Double: + return formatNumber(value.toDouble()); + default: + return value.toString(); + } +#endif } diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 9b93395..bc1328a 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -1349,18 +1349,27 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) QAction* lockGeometryAction = menu.addAction(tr("Lock item geometry")); lockGeometryAction->setCheckable(true); - lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + lockGeometryAction->setChecked(isGeometryLocked()); menu.addSeparator(); QAction* copyAction = menu.addAction(QIcon(":/report/images/copy"), tr("Copy")); - copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); - QAction* cutAction = menu.addAction(QIcon(":/report/images/cut"), tr("Cut")); - cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); + QAction* cutAction = menu.addAction(QIcon(":/report/images/cut"), tr("Cut")); QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste"), tr("Paste")); - pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); 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)); +#else + 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)); +#endif + QClipboard *clipboard = QApplication::clipboard(); ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text()); if (reader->first() && reader->itemType() == "Object"){ diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index f970c86..0315c27 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -85,7 +85,12 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode) query.exec(); QSqlQueryModel *model = new QSqlQueryModel; + +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + model->setQuery(std::move(query)); +#else model->setQuery(query); +#endif while (model->canFetchMore()) model->fetchMore(); diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index fa5e355..91f1189 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -392,7 +392,13 @@ QSharedPointerDataSourceManager::previewSQL(const QString &c } query.exec(); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + model->setQuery(std::move(query)); +#else model->setQuery(query); +#endif + m_lastError = model->lastError().text(); putError(m_lastError); if (model->query().isActive()) @@ -443,7 +449,6 @@ QString DataSourceManager::replaceVariables(QString value){ } result += value.mid(pos); return result; - // TODO: Qt6 port - done #else QRegExp rx(Const::VARIABLE_RX); @@ -508,7 +513,6 @@ QString DataSourceManager::replaceVariables(QString query, QMap match = rx.match(query); } } - // TODO: Qt6 port - done #else QRegExp rx(Const::VARIABLE_RX); int curentAliasIndex = 0; @@ -582,7 +586,6 @@ QString DataSourceManager::replaceFields(QString query, QMap &a match = rx.match(query); } } - // TODO: Qt6 port - done #else QRegExp rx(Const::FIELD_RX); if (query.contains(rx)){ diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 952c8e2..05e8cde 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -519,17 +519,32 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand 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; + //TODO: Migrate to QMetaType +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + switch (dataManager()->fieldData(field).typeId()) { + case QMetaType::QChar: + case QMetaType::QString: + case QMetaType::QStringList: + case QMetaType::QDate: + case QMetaType::QDateTime: + fieldValue = "\""+fieldValue+"\""; + break; + default: + break; } +#else + 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; + } +#endif } } else { if (expandType == ReplaceHTMLSymbols) diff --git a/limereport/objectinspector/editors/lrcomboboxeditor.cpp b/limereport/objectinspector/editors/lrcomboboxeditor.cpp index d034c50..3a4748a 100644 --- a/limereport/objectinspector/editors/lrcomboboxeditor.cpp +++ b/limereport/objectinspector/editors/lrcomboboxeditor.cpp @@ -56,7 +56,12 @@ ComboBoxEditor::ComboBoxEditor(QWidget *parent, bool clearable) : connect(m_buttonClear,SIGNAL(clicked()),this,SLOT(slotClearButtonClicked())); } - connect(m_comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotCurrentIndexChanged(QString))); +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + connect(m_comboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString))); +#else + connect(m_comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString))); +#endif + m_comboBox->installEventFilter(this); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(m_comboBox); diff --git a/limereport/objectinspector/propertyItems/lrrectproptem.cpp b/limereport/objectinspector/propertyItems/lrrectproptem.cpp index 20c2b56..d95e487 100644 --- a/limereport/objectinspector/propertyItems/lrrectproptem.cpp +++ b/limereport/objectinspector/propertyItems/lrrectproptem.cpp @@ -85,6 +85,17 @@ LimeReport::RectPropItem::RectPropItem(QObject *object, ObjectsList* objects, co QString LimeReport::RectPropItem::displayValue() const { + //TODO: Migrate to QMetaType +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + switch(propertyValue().typeId()){ + case QMetaType::QRect: + return rectToString(propertyValue().toRect()); + case QMetaType::QRectF: + return rectToString(propertyValue().toRect()); + default : + return ObjectPropItem::displayValue(); + } +#else switch(propertyValue().type()){ case QVariant::Rect: return rectToString(propertyValue().toRect()); @@ -93,6 +104,7 @@ QString LimeReport::RectPropItem::displayValue() const default : return ObjectPropItem::displayValue(); } +#endif } LimeReport::RectUnitPropItem::RectUnitPropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool /*readonly*/): diff --git a/limereport/serializators/lrxmlwriter.cpp b/limereport/serializators/lrxmlwriter.cpp index 7da6046..fdae62c 100644 --- a/limereport/serializators/lrxmlwriter.cpp +++ b/limereport/serializators/lrxmlwriter.cpp @@ -193,13 +193,23 @@ bool XMLWriter::enumOrFlag(QString name, QObject *item) bool XMLWriter::isCollection(QString propertyName, QObject* item) { QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1())); - return QMetaType::type(prop.typeName())==COLLECTION_TYPE_ID; + //TODO: Migrate to QMetaType +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QMetaType::fromName(prop.typeName()).id() == COLLECTION_TYPE_ID; +#else + return QMetaType::type(prop.typeName()) == COLLECTION_TYPE_ID; +#endif } bool XMLWriter::isTranslation(QString propertyName, QObject* item) { QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1())); - return QMetaType::type(prop.typeName())==TRANSLATION_TYPE_ID; + //TODO: Migrate to QMetaType +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QMetaType::fromName(prop.typeName()).id() == TRANSLATION_TYPE_ID; +#else + return QMetaType::type(prop.typeName()) == TRANSLATION_TYPE_ID; +#endif } void XMLWriter::saveCollection(QString propertyName, QObject *item, QDomElement *node) @@ -254,7 +264,13 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement bool XMLWriter::isQObject(QString propertyName, QObject *item) { QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1())); - return QMetaType::type(prop.typeName())==QMetaType::QObjectStar; + //TODO: Migrate to QMetaType +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + return QMetaType::fromName(prop.typeName()).id() == QMetaType::QObjectStar; +#else + return QMetaType::type(prop.typeName()) == QMetaType::QObjectStar; +#endif + } bool XMLWriter::replaceNode(QDomElement node, QObject* item) diff --git a/limereport/translationeditor/translationeditor.cpp b/limereport/translationeditor/translationeditor.cpp index 8006c3b..a2e693e 100644 --- a/limereport/translationeditor/translationeditor.cpp +++ b/limereport/translationeditor/translationeditor.cpp @@ -29,7 +29,11 @@ TranslationEditor::TranslationEditor(QWidget *parent) : ui->tbStrings->setHorizontalHeaderItem(1,new QTableWidgetItem(tr("Report Item"))); ui->tbStrings->setHorizontalHeaderItem(2,new QTableWidgetItem(tr("Property"))); ui->tbStrings->setHorizontalHeaderItem(3,new QTableWidgetItem(tr("Source text"))); - new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked())); +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return), this, SLOT(slotItemChecked())); +#else + m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked())); +#endif //ui->tbStrings->setSortingEnabled(true); } @@ -50,6 +54,7 @@ void TranslationEditor::setReportEngine(ITranslationContainer* translationContai TranslationEditor::~TranslationEditor() { delete ui; + delete m_clrReturn; } QLocale::Language TranslationEditor::getLanguageByName(const QString& languageName){ diff --git a/limereport/translationeditor/translationeditor.h b/limereport/translationeditor/translationeditor.h index 48fbb0b..954bf34 100644 --- a/limereport/translationeditor/translationeditor.h +++ b/limereport/translationeditor/translationeditor.h @@ -46,6 +46,7 @@ private: PageTranslation* m_currentPageTranslation; PropertyTranslation* m_currentPropertyTranslation; bool m_translationChanging; + QShortcut* m_clrReturn; }; } //namespace LimeReport