Finish 1.7.10

This commit is contained in:
Arin Alex 2024-07-24 22:45:08 +03:00
commit f3d2efe8ca
14 changed files with 142 additions and 21 deletions

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(limereport) project(limereport)
set(DEFAULT_ITEM_PADDING 0)
set(LIMEREPORT_VERSION_MAJOR 1) set(LIMEREPORT_VERSION_MAJOR 1)
set(LIMEREPORT_VERSION_MINOR 7) set(LIMEREPORT_VERSION_MINOR 7)
set(LIMEREPORT_VERSION_RELEASE 9) set(LIMEREPORT_VERSION_RELEASE 9)
@ -391,7 +392,7 @@ if(ENABLE_ZINT)
target_link_libraries( ${PROJECT_NAME} PRIVATE QZint) target_link_libraries( ${PROJECT_NAME} PRIVATE QZint)
endif(ENABLE_ZINT) endif(ENABLE_ZINT)
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS) target_compile_definitions( ${PROJECT_NAME} PRIVATE -DDEFAULT_ITEM_PADDING=${DEFAULT_ITEM_PADDING} -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS)
target_include_directories( ${PROJECT_NAME} PRIVATE target_include_directories( ${PROJECT_NAME} PRIVATE
limereport/ limereport/

View File

@ -132,12 +132,27 @@ namespace Const{
class LIMEREPORT_EXPORT ReportSettings{ class LIMEREPORT_EXPORT ReportSettings{
public: public:
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){} #ifdef DEFAULT_ITEM_PADDING
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;} ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(DEFAULT_ITEM_PADDING){}
#else
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0){}
#endif
void setDefaultValues(){
m_suppressAbsentFieldsAndVarsWarnings = false;
#ifdef DEFAULT_ITEM_PADDING
m_baseItemPadding = DEFAULT_ITEM_PADDING;
#else
m_baseItemPadding = 0;
#endif
}
bool suppressAbsentFieldsAndVarsWarnings() const; bool suppressAbsentFieldsAndVarsWarnings() const;
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings); void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
int baseItemPadding() const;
void setBaseItemPadding(int newBaseTextItemPadding);
private: private:
bool m_suppressAbsentFieldsAndVarsWarnings; bool m_suppressAbsentFieldsAndVarsWarnings;
int m_baseItemPadding;
}; };
class LIMEREPORT_EXPORT IExternalPainter{ class LIMEREPORT_EXPORT IExternalPainter{

View File

@ -1,3 +1,5 @@
DEFINES += DEFAULT_ITEM_PADDING=0
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
TARGET = limereportd TARGET = limereportd
} else { } else {

View File

@ -295,7 +295,9 @@ public:
int possibleMoveDirectionFlags() const; int possibleMoveDirectionFlags() const;
void setPossibleMoveFlags(int directionsFlags); void setPossibleMoveFlags(int directionsFlags);
int marginSize() const {return m_margin;} int marginSize() const {
return m_margin + m_reportSettings != 0 ? m_reportSettings->baseItemPadding() : 0;
}
void setMarginSize(int value); void setMarginSize(int value);
QString itemTypeName() const; QString itemTypeName() const;
@ -494,7 +496,7 @@ private:
bool m_itemGeometryLocked; bool m_itemGeometryLocked;
bool m_isChangingPos; bool m_isChangingPos;
bool m_isMoveable; bool m_isMoveable;
bool m_shadow; bool m_shadow;
signals: signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);

View File

@ -51,6 +51,16 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
} }
int ReportSettings::baseItemPadding() const
{
return m_baseItemPadding;
}
void ReportSettings::setBaseItemPadding(int newBaseTextItemPadding)
{
m_baseItemPadding = newBaseTextItemPadding;
}
QString escapeSimbols(const QString &value) QString escapeSimbols(const QString &value)
{ {
QString result = value; QString result = value;

View File

@ -132,12 +132,27 @@ namespace Const{
class LIMEREPORT_EXPORT ReportSettings{ class LIMEREPORT_EXPORT ReportSettings{
public: public:
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){} #ifdef DEFAULT_ITEM_PADDING
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;} ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(DEFAULT_ITEM_PADDING){}
#else
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0){}
#endif
void setDefaultValues(){
m_suppressAbsentFieldsAndVarsWarnings = false;
#ifdef DEFAULT_ITEM_PADDING
m_baseItemPadding = DEFAULT_ITEM_PADDING;
#else
m_baseItemPadding = 0;
#endif
}
bool suppressAbsentFieldsAndVarsWarnings() const; bool suppressAbsentFieldsAndVarsWarnings() const;
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings); void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
int baseItemPadding() const;
void setBaseItemPadding(int newBaseTextItemPadding);
private: private:
bool m_suppressAbsentFieldsAndVarsWarnings; bool m_suppressAbsentFieldsAndVarsWarnings;
int m_baseItemPadding;
}; };
class LIMEREPORT_EXPORT IExternalPainter{ class LIMEREPORT_EXPORT IExternalPainter{

View File

@ -531,6 +531,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage; PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage;
if (page){ if (page){
BaseDesignIntf *reportItem = addReportItem(itemType, page, page); BaseDesignIntf *reportItem = addReportItem(itemType, page, page);
reportItem->setReportSettings(m_reportSettings);
reportItem->setPos(placePosOnGrid(page->mapFromScene(pos))); reportItem->setPos(placePosOnGrid(page->mapFromScene(pos)));
reportItem->setSize(placeSizeOnGrid(size)); reportItem->setSize(placeSizeOnGrid(size));
reportItem->setUnitType(pageItem()->unitType()); reportItem->setUnitType(pageItem()->unitType());

View File

@ -801,6 +801,7 @@ void ReportDesignWidget::editSetting()
setting.setHorizontalGridStep(m_horizontalGridStep); setting.setHorizontalGridStep(m_horizontalGridStep);
setting.setDefaultFont(m_defaultFont); setting.setDefaultFont(m_defaultFont);
setting.setSuppressAbsentFieldsAndVarsWarnings(m_report->suppressFieldAndVarError()); setting.setSuppressAbsentFieldsAndVarsWarnings(m_report->suppressFieldAndVarError());
setting.setBaseItemPadding(m_report->baseItemPadding());
QStringList themes; QStringList themes;
themes.append(QObject::tr("Default")); themes.append(QObject::tr("Default"));
@ -833,6 +834,7 @@ void ReportDesignWidget::editSetting()
m_theme = "Default"; m_theme = "Default";
} }
m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings()); m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings());
m_report->setBaseItemPadding(setting.baseItemPadding());
if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){ if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){
m_report->setCurrentDesignerLanguage(setting.designerLanguage()); m_report->setCurrentDesignerLanguage(setting.designerLanguage());
} }

View File

@ -1167,9 +1167,9 @@ void ReportDesignWindow::slotSaveReportAs()
void ReportDesignWindow::slotLoadReport() void ReportDesignWindow::slotLoadReport()
{ {
if (!checkNeedToSave()) return; // don't need to save if (!checkNeedToSave()) return;
if (m_reportDesignWidget->emitLoadReport()) return; // report loaded via signal if (m_reportDesignWidget->emitLoadReport()) return;
QString fileName = QFileDialog::getOpenFileName( QString fileName = QFileDialog::getOpenFileName(
this,tr("Report file name"), this,tr("Report file name"),

View File

@ -1174,6 +1174,16 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError); m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
} }
int ReportEnginePrivate::baseItemPadding() const
{
return m_reportSettings.baseItemPadding();
}
void ReportEnginePrivate::setBaseItemPadding(int baseTextItemPadding)
{
m_reportSettings.setBaseItemPadding(baseTextItemPadding);
}
bool ReportEnginePrivate::isBusy() bool ReportEnginePrivate::isBusy()
{ {
return m_reportRendering; return m_reportRendering;

View File

@ -114,6 +114,8 @@ public:
virtual void setShowProgressDialog(bool value) = 0; virtual void setShowProgressDialog(bool value) = 0;
virtual bool isShowProgressDialog() const = 0; virtual bool isShowProgressDialog() const = 0;
virtual bool isBusy() = 0; virtual bool isBusy() = 0;
virtual int baseItemPadding() const = 0;
virtual void setBaseItemPadding(int baseTextItemPadding) = 0;
}; };
class PrintProcessor{ class PrintProcessor{
@ -142,6 +144,7 @@ class ReportEnginePrivate : public QObject,
Q_PROPERTY(QObject* datasourcesManager READ dataManager) Q_PROPERTY(QObject* datasourcesManager READ dataManager)
Q_PROPERTY(QObject* scriptContext READ scriptContext) Q_PROPERTY(QObject* scriptContext READ scriptContext)
Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError) Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError)
Q_PROPERTY(int baseItemPadding READ baseItemPadding WRITE setBaseItemPadding)
Q_PROPERTY(ATranslationProperty translation READ fakeTranslationReader) Q_PROPERTY(ATranslationProperty translation READ fakeTranslationReader)
enum AppendType{MixPages, AppendPages}; enum AppendType{MixPages, AppendPages};
@ -221,6 +224,8 @@ public:
bool suppressFieldAndVarError() const; bool suppressFieldAndVarError() const;
void setSuppressFieldAndVarError(bool suppressFieldAndVarError); void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
int baseItemPadding() const;
void setBaseItemPadding(int baseTextItemPadding);
bool isBusy(); bool isBusy();
bool resultIsEditable() const; bool resultIsEditable() const;
void setResultEditable(bool value); void setResultEditable(bool value);

View File

@ -73,10 +73,20 @@ QString SettingDialog::reportUnits()
return ui->reportUnits->currentText(); return ui->reportUnits->currentText();
} }
int SettingDialog::baseItemPadding()
{
return ui->neBaseItemPadding->value();
}
void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){ void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){
ui->cbSuppressWarnings->setChecked(value); ui->cbSuppressWarnings->setChecked(value);
} }
void SettingDialog::setBaseItemPadding(int value)
{
ui->neBaseItemPadding->setValue(value);
}
void SettingDialog::setHorizontalGridStep(int value) void SettingDialog::setHorizontalGridStep(int value)
{ {
ui->horizontalGridStep->setValue(value); ui->horizontalGridStep->setValue(value);

View File

@ -27,7 +27,9 @@ public:
bool suppressAbsentFieldsAndVarsWarnings(); bool suppressAbsentFieldsAndVarsWarnings();
QLocale::Language designerLanguage(); QLocale::Language designerLanguage();
QString reportUnits(); QString reportUnits();
int baseItemPadding();
void setSuppressAbsentFieldsAndVarsWarnings(bool value); void setSuppressAbsentFieldsAndVarsWarnings(bool value);
void setBaseItemPadding(int value);
void setHorizontalGridStep(int value); void setHorizontalGridStep(int value);
void setVerticalGridStep(int value); void setVerticalGridStep(int value);
void setDefaultFont(const QFont& value); void setDefaultFont(const QFont& value);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>521</width> <width>521</width>
<height>445</height> <height>506</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -23,15 +23,15 @@
<item> <item>
<widget class="QToolBox" name="toolBox"> <widget class="QToolBox" name="toolBox">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>503</width> <width>499</width>
<height>301</height> <height>339</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -215,8 +215,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>503</width> <width>499</width>
<height>301</height> <height>339</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -304,8 +304,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>503</width> <width>499</width>
<height>301</height> <height>339</height>
</rect> </rect>
</property> </property>
<attribute name="label"> <attribute name="label">
@ -319,6 +319,52 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Base Item Padding: </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="neBaseItemPadding">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>46</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>44</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item> <item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -374,8 +420,8 @@
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>221</x> <x>485</x>
<y>307</y> <y>493</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>157</x> <x>157</x>
@ -390,8 +436,8 @@
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>221</x> <x>485</x>
<y>307</y> <y>493</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>286</x> <x>286</x>