0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-19 22:27:01 +03:00

Merge tag '1.5.88' into develop

Finish 1.5.88

# Conflicts:
#	limereport/limereport.pri
#	limereport/limereport.pro
This commit is contained in:
fralx
2021-09-11 19:29:52 +03:00
239 changed files with 2492 additions and 999 deletions

View File

@@ -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 **

View File

@@ -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);

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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);

View File

@@ -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 **

View File

@@ -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;

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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(

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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));
}

View File

@@ -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 **

View File

@@ -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

View File

@@ -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

View File

@@ -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) {

View File

@@ -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)));

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 (maxWidth<fm.width(label))
maxWidth = fm.width(label)+10;
if (maxWidth<fm.boundingRect(label).width())
maxWidth = fm.boundingRect(label).width()+10;
}
} else {
foreach(QString label, m_designLabels){
cw += fm.height();
if (maxWidth<fm.width(label))
maxWidth = fm.width(label)+10;
if (maxWidth<fm.boundingRect(label).width())
maxWidth = fm.boundingRect(label).width()+10;
}
}
cw += fm.height();

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **
@@ -53,7 +53,7 @@ void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, cons
void ItemsBordersEditorWidget::noBordesClicked()
{
updateValues(0);
updateValues({});
}
void ItemsBordersEditorWidget::allBordesClicked()
@@ -148,7 +148,7 @@ void ItemsBordersEditorWidgetForDesigner::buttonClicked(bool)
void ItemsBordersEditorWidgetForDesigner::noBordesClicked()
{
m_reportEditor->setBorders(0);
m_reportEditor->setBorders({});
ItemsBordersEditorWidget::noBordesClicked();
}

View File

@@ -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 **

View File

@@ -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;

View File

@@ -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 **

View File

@@ -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)

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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)

View File

@@ -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 (maxWidth<fm.width(series->name()))
maxWidth = fm.width(series->name())+10;
if (maxWidth<fm.boundingRect(series->name()).width())
maxWidth = fm.boundingRect(series->name()).width()+10;
}
} else {
foreach(QString label, m_designLabels){
cw += fm.height();
if (maxWidth<fm.width(label))
maxWidth = fm.width(label)+10;
if (maxWidth<fm.boundingRect(label).width())
maxWidth = fm.boundingRect(label).width()+10;
}
}
cw += fm.height();
@@ -591,7 +591,7 @@ bool AbstractSeriesChart::verticalLabels(QPainter* painter, QRectF labelsRect)
qreal hStep = (labelsRect.width() / valuesCount());
QFontMetrics fm = painter->fontMetrics();
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<QFontMetricsF> 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))

View File

@@ -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)

View File

@@ -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();
}

View File

@@ -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()) {

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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)

View File

@@ -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 **

View File

@@ -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)

View File

@@ -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 <QRegExp>
#include <QDebug>
#include <QStringList>
#if QT_VERSION < 0x060000
#include <QRegExp>
#else
#include <QRegularExpression>
#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<Tag *> &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<Tag *> &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()

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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;

View File

@@ -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)

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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 <config.h>
#endif
#include "lraboutdialog.h"
#include "ui_lraboutdialog.h"

View File

@@ -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 **

View File

@@ -42,7 +42,7 @@ p, li { white-space: pre-wrap; }
&lt;p align=&quot;justify&quot; style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-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;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright 2015 Arin Alexander. All rights reserved.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright 2021 Arin Alexander. All rights reserved.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@@ -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<QRectF> 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 *> BandDesignIntf::childrenByType(BandDesignIntf::BandsType
foreach(BandDesignIntf* item,childBands()){
if (item->bandType()==type) resList<<item;
}
qSort(resList.begin(),resList.end(),bandIndexLessThen);
std::sort(resList.begin(),resList.end(),bandIndexLessThen);
return resList;
}
@@ -1223,7 +1223,7 @@ void BandNameLabel::updateLabel(const QString& bandName)
m_rect = QRectF(
m_band->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();
}

View File

@@ -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);
};

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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)

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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<ConnectionDesc> 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;}

View File

@@ -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 <QStringList>
#include <QSqlQuery>
#if QT_VERSION < 0x060000
#include <QRegExp>
#endif
#include <QSqlError>
#include <QSqlQueryModel>
#include <QFileInfo>
@@ -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<QString,QString> &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<QString,QString>
}
}
return query;
#else
QRegularExpression rx(Const::VARIABLE_RX);
// TODO: Qt6 port
#endif
return QString();
}
QString DataSourceManager::replaceFields(QString query, QMap<QString,QString> &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<QString,QString> &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<QueryHolder*>(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);

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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 **

View File

@@ -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<QString> normalizeCaptures(const QRegExp& reg){
#else
QVector<QString> normalizeCaptures(const QRegularExpressionMatch& reg){
#endif
QVector<QString> result;
foreach (QString cap, reg.capturedTexts()) {
if (!cap.isEmpty())

View File

@@ -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<QString> normalizeCaptures(const QRegExp &reg);
#else
QVector<QString> normalizeCaptures(const QRegularExpressionMatch &reg);
#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)

View File

@@ -53,12 +53,21 @@ bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {
} else if (event->type() == QEvent::Wheel) {
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(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)

View File

@@ -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 <QRegExp>
#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;
}

View File

@@ -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 **

View File

@@ -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 <QDebug>
#if QT_VERSION < 0x060000
#include <QRegExp>
#endif
#include <QVariant>
namespace LimeReport{

View File

@@ -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)

View File

@@ -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)

View File

@@ -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<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(" \\[.*\\]"));
#else
if (isVar) data = data.remove(QRegularExpression(" \\[.*\\]"));
#endif
ti->setContent(data);
if (!isVar){
BandDesignIntf* parentBand = dynamic_cast<BandDesignIntf*>(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<QGraphicsItem *> si = selectedItems();
QList<QGraphicsItem *>::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<QGraphicsItem *> si = selectedItems();
QList<QGraphicsItem *>::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);
}
}
}

View File

@@ -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;

View File

@@ -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<qreal> 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<BandDesignIntf*> 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;
}

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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 <QPrintDialog>
#include <QFileDialog>
#include <QScrollBar>
#if QT_VERSION < 0x060000
#include <QDesktopWidget>
#else
#include <QScreen>
#endif
#include <QLabel>
#include <QMessageBox>
#include <QToolButton>
@@ -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<int>(screenWidth*0.1);
int y = static_cast<int>(screenHeight*0.1);

Some files were not shown because too many files have changed in this diff Show More