mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Default item paddings have been added to report settings.
This commit is contained in:
parent
e833461923
commit
d97e7e9abe
@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(limereport)
|
||||
|
||||
set(DEFAULT_ITEM_PADDING 0)
|
||||
set(LIMEREPORT_VERSION_MAJOR 1)
|
||||
set(LIMEREPORT_VERSION_MINOR 7)
|
||||
set(LIMEREPORT_VERSION_RELEASE 9)
|
||||
@ -391,7 +392,7 @@ if(ENABLE_ZINT)
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE QZint)
|
||||
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
|
||||
limereport/
|
||||
|
@ -132,12 +132,27 @@ namespace Const{
|
||||
|
||||
class LIMEREPORT_EXPORT ReportSettings{
|
||||
public:
|
||||
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){}
|
||||
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;}
|
||||
#ifdef DEFAULT_ITEM_PADDING
|
||||
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;
|
||||
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
|
||||
int baseItemPadding() const;
|
||||
void setBaseItemPadding(int newBaseTextItemPadding);
|
||||
private:
|
||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||
int m_baseItemPadding;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT IExternalPainter{
|
||||
|
@ -1,3 +1,5 @@
|
||||
DEFINES += DEFAULT_ITEM_PADDING=0
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
TARGET = limereportd
|
||||
} else {
|
||||
|
@ -295,7 +295,9 @@ public:
|
||||
int possibleMoveDirectionFlags() const;
|
||||
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);
|
||||
|
||||
QString itemTypeName() const;
|
||||
|
@ -51,6 +51,16 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
|
||||
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
|
||||
}
|
||||
|
||||
int ReportSettings::baseItemPadding() const
|
||||
{
|
||||
return m_baseItemPadding;
|
||||
}
|
||||
|
||||
void ReportSettings::setBaseItemPadding(int newBaseTextItemPadding)
|
||||
{
|
||||
m_baseItemPadding = newBaseTextItemPadding;
|
||||
}
|
||||
|
||||
QString escapeSimbols(const QString &value)
|
||||
{
|
||||
QString result = value;
|
||||
|
@ -132,12 +132,27 @@ namespace Const{
|
||||
|
||||
class LIMEREPORT_EXPORT ReportSettings{
|
||||
public:
|
||||
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){}
|
||||
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;}
|
||||
#ifdef DEFAULT_ITEM_PADDING
|
||||
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;
|
||||
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
|
||||
int baseItemPadding() const;
|
||||
void setBaseItemPadding(int newBaseTextItemPadding);
|
||||
private:
|
||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||
int m_baseItemPadding;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT IExternalPainter{
|
||||
|
@ -531,6 +531,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
|
||||
PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage;
|
||||
if (page){
|
||||
BaseDesignIntf *reportItem = addReportItem(itemType, page, page);
|
||||
reportItem->setReportSettings(m_reportSettings);
|
||||
reportItem->setPos(placePosOnGrid(page->mapFromScene(pos)));
|
||||
reportItem->setSize(placeSizeOnGrid(size));
|
||||
reportItem->setUnitType(pageItem()->unitType());
|
||||
|
@ -801,6 +801,7 @@ void ReportDesignWidget::editSetting()
|
||||
setting.setHorizontalGridStep(m_horizontalGridStep);
|
||||
setting.setDefaultFont(m_defaultFont);
|
||||
setting.setSuppressAbsentFieldsAndVarsWarnings(m_report->suppressFieldAndVarError());
|
||||
setting.setBaseItemPadding(m_report->baseItemPadding());
|
||||
|
||||
QStringList themes;
|
||||
themes.append(QObject::tr("Default"));
|
||||
@ -833,6 +834,7 @@ void ReportDesignWidget::editSetting()
|
||||
m_theme = "Default";
|
||||
}
|
||||
m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings());
|
||||
m_report->setBaseItemPadding(setting.baseItemPadding());
|
||||
if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){
|
||||
m_report->setCurrentDesignerLanguage(setting.designerLanguage());
|
||||
}
|
||||
|
@ -1167,9 +1167,9 @@ void ReportDesignWindow::slotSaveReportAs()
|
||||
|
||||
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(
|
||||
this,tr("Report file name"),
|
||||
|
@ -1174,6 +1174,16 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr
|
||||
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
|
||||
}
|
||||
|
||||
int ReportEnginePrivate::baseItemPadding() const
|
||||
{
|
||||
return m_reportSettings.baseItemPadding();
|
||||
}
|
||||
|
||||
void ReportEnginePrivate::setBaseItemPadding(int baseTextItemPadding)
|
||||
{
|
||||
m_reportSettings.setBaseItemPadding(baseTextItemPadding);
|
||||
}
|
||||
|
||||
bool ReportEnginePrivate::isBusy()
|
||||
{
|
||||
return m_reportRendering;
|
||||
|
@ -114,6 +114,8 @@ public:
|
||||
virtual void setShowProgressDialog(bool value) = 0;
|
||||
virtual bool isShowProgressDialog() const = 0;
|
||||
virtual bool isBusy() = 0;
|
||||
virtual int baseItemPadding() const = 0;
|
||||
virtual void setBaseItemPadding(int baseTextItemPadding) = 0;
|
||||
};
|
||||
|
||||
class PrintProcessor{
|
||||
@ -142,6 +144,7 @@ class ReportEnginePrivate : public QObject,
|
||||
Q_PROPERTY(QObject* datasourcesManager READ dataManager)
|
||||
Q_PROPERTY(QObject* scriptContext READ scriptContext)
|
||||
Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError)
|
||||
Q_PROPERTY(int baseItemPadding READ baseItemPadding WRITE setBaseItemPadding)
|
||||
Q_PROPERTY(ATranslationProperty translation READ fakeTranslationReader)
|
||||
|
||||
enum AppendType{MixPages, AppendPages};
|
||||
@ -221,6 +224,8 @@ public:
|
||||
|
||||
bool suppressFieldAndVarError() const;
|
||||
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
|
||||
int baseItemPadding() const;
|
||||
void setBaseItemPadding(int baseTextItemPadding);
|
||||
bool isBusy();
|
||||
bool resultIsEditable() const;
|
||||
void setResultEditable(bool value);
|
||||
|
@ -73,10 +73,20 @@ QString SettingDialog::reportUnits()
|
||||
return ui->reportUnits->currentText();
|
||||
}
|
||||
|
||||
int SettingDialog::baseItemPadding()
|
||||
{
|
||||
return ui->neBaseItemPadding->value();
|
||||
}
|
||||
|
||||
void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){
|
||||
ui->cbSuppressWarnings->setChecked(value);
|
||||
}
|
||||
|
||||
void SettingDialog::setBaseItemPadding(int value)
|
||||
{
|
||||
ui->neBaseItemPadding->setValue(value);
|
||||
}
|
||||
|
||||
void SettingDialog::setHorizontalGridStep(int value)
|
||||
{
|
||||
ui->horizontalGridStep->setValue(value);
|
||||
|
@ -27,7 +27,9 @@ public:
|
||||
bool suppressAbsentFieldsAndVarsWarnings();
|
||||
QLocale::Language designerLanguage();
|
||||
QString reportUnits();
|
||||
int baseItemPadding();
|
||||
void setSuppressAbsentFieldsAndVarsWarnings(bool value);
|
||||
void setBaseItemPadding(int value);
|
||||
void setHorizontalGridStep(int value);
|
||||
void setVerticalGridStep(int value);
|
||||
void setDefaultFont(const QFont& value);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>521</width>
|
||||
<height>445</height>
|
||||
<height>506</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -23,15 +23,15 @@
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>301</height>
|
||||
<width>499</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -215,8 +215,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>301</height>
|
||||
<width>499</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -304,8 +304,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>301</height>
|
||||
<width>499</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
@ -319,6 +319,52 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
@ -374,8 +420,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>221</x>
|
||||
<y>307</y>
|
||||
<x>485</x>
|
||||
<y>493</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
@ -390,8 +436,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>221</x>
|
||||
<y>307</y>
|
||||
<x>485</x>
|
||||
<y>493</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
|
Loading…
Reference in New Issue
Block a user