diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 4e8e111..a29289a 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -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 < 0x050000 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/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 93827f9..1fc9dd5 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -1392,7 +1392,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/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/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index f245fcb..c0ff952 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -752,8 +752,12 @@ 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()); diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 009394b..0d57563 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -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 { diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 235a4f8..b59ca70 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -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); diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index 798464b..cae9df2 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -842,7 +842,6 @@ void ReportDesignWindow::restoreSetting() int screenWidth = desktop->screenGeometry().width(); int screenHeight = desktop->screenGeometry().height(); - #else QScreen *screen = QGuiApplication::primaryScreen(); @@ -1541,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/lrsettingdialog.cpp b/limereport/lrsettingdialog.cpp index 53ef9ab..6568e0e 100644 --- a/limereport/lrsettingdialog.cpp +++ b/limereport/lrsettingdialog.cpp @@ -151,7 +151,7 @@ void SettingDialog::setDesignerUnites(QList unitTypes, const QString cu ui->reportUnits->clear(); ui->reportUnits->addItems(unitTypes); #if QT_VERSION < 0x050000 - ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType)); + ui->reportUnits->setCurrentIndex(ui->reportUnits->findText(currentUnitType)); #else ui->reportUnits->setCurrentText(currentUnitType); #endif diff --git a/limereport/objectinspector/lrobjectinspectorwidget.cpp b/limereport/objectinspector/lrobjectinspectorwidget.cpp index 9fd3852..413c403 100644 --- a/limereport/objectinspector/lrobjectinspectorwidget.cpp +++ b/limereport/objectinspector/lrobjectinspectorwidget.cpp @@ -182,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); @@ -310,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)