This commit is contained in:
Rodrigo Torres 2021-08-24 02:37:40 -03:00
parent 7dad9d700b
commit fa6cbef6a7
9 changed files with 56 additions and 3 deletions

View File

@ -360,7 +360,11 @@ void TextItem::updateLayout()
bool TextItem::isNeedExpandContent() const bool TextItem::isNeedExpandContent() const
{ {
#if QT_VERSION < 0x060000
QRegExp rx("$*\\{[^{]*\\}"); QRegExp rx("$*\\{[^{]*\\}");
#else
QRegularExpression rx("$*\\{[^{]*\\}");
#endif
return content().contains(rx) || isContentBackedUp(); return content().contains(rx) || isContentBackedUp();
} }
@ -448,7 +452,11 @@ QString TextItem::formatNumber(const double value)
if (m_format.contains("%")) if (m_format.contains("%"))
{ {
#if QT_VERSION < 0x050000
str.sprintf(m_format.toStdString().c_str(), value); 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().groupSeparator());
str = str.replace(".", QLocale::system().decimalPoint()); str = str.replace(".", QLocale::system().decimalPoint());
} }
@ -813,7 +821,11 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
{ {
QString context=content(); QString context=content();
foreach (QString variableName, dataManager->variableNamesByRenderPass(SecondPass)) { foreach (QString variableName, dataManager->variableNamesByRenderPass(SecondPass)) {
#if QT_VERSION < 0x060000
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); 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){ if (context.contains(rx) && pass == FirstPass){
backupContent(); backupContent();
break; break;

View File

@ -1392,7 +1392,11 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl
foreach (const QString& datasourceName, dataSourceNames()){ foreach (const QString& datasourceName, dataSourceNames()){
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName)); QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
if (holder){ if (holder){
#if QT_VERSION < 0x060000
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName)); 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)){ if (holder->queryText().contains(rx)){
holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE); holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
datasources.append(datasourceName); datasources.append(datasourceName);

View File

@ -53,12 +53,21 @@ bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {
} else if (event->type() == QEvent::Wheel) { } else if (event->type() == QEvent::Wheel) {
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event); QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
if (QApplication::keyboardModifiers() == m_modifiers) { if (QApplication::keyboardModifiers() == m_modifiers) {
#if QT_VERSION < 0x060000
if (wheel_event->orientation() == Qt::Vertical) { if (wheel_event->orientation() == Qt::Vertical) {
double angle = wheel_event->delta(); double angle = wheel_event->delta();
double factor = qPow(m_zoomFactorBase, angle); double factor = qPow(m_zoomFactorBase, angle);
gentleZoom(factor); gentleZoom(factor);
return true; 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) Q_UNUSED(object)

View File

@ -752,8 +752,12 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event)
bool isVar = event->mimeData()->text().indexOf("variable:")==0; bool isVar = event->mimeData()->text().indexOf("variable:")==0;
BaseDesignIntf* item = addReportItem("TextItem",event->scenePos(),QSize(250, 50)); BaseDesignIntf* item = addReportItem("TextItem",event->scenePos(),QSize(250, 50));
TextItem* ti = dynamic_cast<TextItem*>(item); TextItem* ti = dynamic_cast<TextItem*>(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(" \\[.*\\]")); if (isVar) data = data.remove(QRegExp(" \\[.*\\]"));
#else
if (isVar) data = data.remove(QRegularExpression(" \\[.*\\]"));
#endif
ti->setContent(data); ti->setContent(data);
if (!isVar){ if (!isVar){
BandDesignIntf* parentBand = dynamic_cast<BandDesignIntf*>(ti->parentItem()); BandDesignIntf* parentBand = dynamic_cast<BandDesignIntf*>(ti->parentItem());

View File

@ -711,10 +711,18 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size)
if (size != Custom) { if (size != Custom) {
QPrinter printer; QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFormat(QPrinter::PdfFormat);
#if QT_VERSION < 0x060000
printer.setOrientation((QPrinter::Orientation)pageOrientation()); printer.setOrientation((QPrinter::Orientation)pageOrientation());
printer.setPaperSize((QPrinter::PageSize)size); printer.setPaperSize((QPrinter::PageSize)size);
return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10, return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10,
printer.paperSize(QPrinter::Millimeter).height() * 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 { else {

View File

@ -1058,8 +1058,13 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
if (event->type() == QEvent::Wheel){ if (event->type() == QEvent::Wheel){
QWheelEvent* we = dynamic_cast<QWheelEvent*>(event); QWheelEvent* we = dynamic_cast<QWheelEvent*>(event);
if (QApplication::keyboardModifiers()==Qt::ControlModifier){ if (QApplication::keyboardModifiers()==Qt::ControlModifier){
#if QT_VERSION < 0x060000
if(we->delta()<0) scale(1.2,1.2); if(we->delta()<0) scale(1.2,1.2);
else scale(1/1.2,1/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); return QWidget::eventFilter(target,event);

View File

@ -842,7 +842,6 @@ void ReportDesignWindow::restoreSetting()
int screenWidth = desktop->screenGeometry().width(); int screenWidth = desktop->screenGeometry().width();
int screenHeight = desktop->screenGeometry().height(); int screenHeight = desktop->screenGeometry().height();
#else #else
QScreen *screen = QGuiApplication::primaryScreen(); QScreen *screen = QGuiApplication::primaryScreen();
@ -1541,7 +1540,11 @@ void ReportDesignWindow::slotPageDeleted()
void ReportDesignWindow::slotFilterTextChanged(const QString& filter) void ReportDesignWindow::slotFilterTextChanged(const QString& filter)
{ {
#if QT_VERSION < 0x060000
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
#else
m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
#endif
} }
#ifdef HAVE_QTDESIGNER_INTEGRATION #ifdef HAVE_QTDESIGNER_INTEGRATION

View File

@ -151,7 +151,7 @@ void SettingDialog::setDesignerUnites(QList<QString> unitTypes, const QString cu
ui->reportUnits->clear(); ui->reportUnits->clear();
ui->reportUnits->addItems(unitTypes); ui->reportUnits->addItems(unitTypes);
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType)); ui->reportUnits->setCurrentIndex(ui->reportUnits->findText(currentUnitType));
#else #else
ui->reportUnits->setCurrentText(currentUnitType); ui->reportUnits->setCurrentText(currentUnitType);
#endif #endif

View File

@ -182,7 +182,11 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
m_propertyModel = new BaseDesignPropertyModel(this); m_propertyModel = new BaseDesignPropertyModel(this);
m_filterModel = new PropertyFilterModel(this); m_filterModel = new PropertyFilterModel(this);
m_filterModel->setSourceModel(m_propertyModel); m_filterModel->setSourceModel(m_propertyModel);
#if QT_VERSION < 0x060000
m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString)); m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString));
#else
m_filterModel->setFilterRegularExpression(QRegularExpression("", QRegularExpression::CaseInsensitiveOption));
#endif
m_objectInspectorView->setModel(m_filterModel); m_objectInspectorView->setModel(m_filterModel);
QVBoxLayout* l = new QVBoxLayout(); QVBoxLayout* l = new QVBoxLayout();
QLineEdit* le = new QLineEdit(this); QLineEdit* le = new QLineEdit(this);
@ -310,7 +314,11 @@ void ObjectInspectorWidget::updateProperty(const QString &propertyName)
void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter) void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter)
{ {
if (m_filterModel) if (m_filterModel)
#if QT_VERSION < 0x060000
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString)); m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
#else
m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
#endif
} }
void ObjectInspectorWidget::slotTranslatePropertiesChecked(bool value) void ObjectInspectorWidget::slotTranslatePropertiesChecked(bool value)