mirror of
https://github.com/fralx/LimeReport.git
synced 2025-01-11 17:18:10 +03:00
ReportSettings have been added to report items
This commit is contained in:
parent
779eefcab5
commit
ac98da1394
@ -75,7 +75,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_margin(4),
|
m_margin(4),
|
||||||
m_itemAlign(DesignedItemAlign),
|
m_itemAlign(DesignedItemAlign),
|
||||||
m_changingItemAlign(false),
|
m_changingItemAlign(false),
|
||||||
m_borderColor(Qt::black)
|
m_borderColor(Qt::black),
|
||||||
|
m_reportSettings(0)
|
||||||
{
|
{
|
||||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||||
@ -626,6 +627,19 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReportSettings *BaseDesignIntf::reportSettings() const
|
||||||
|
{
|
||||||
|
return m_reportSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseDesignIntf::setReportSettings(ReportSettings *reportSettings)
|
||||||
|
{
|
||||||
|
m_reportSettings = reportSettings;
|
||||||
|
foreach(BaseDesignIntf* child, childBaseItems()){
|
||||||
|
child->setReportSettings(reportSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QColor BaseDesignIntf::borderColor() const
|
QColor BaseDesignIntf::borderColor() const
|
||||||
{
|
{
|
||||||
return m_borderColor;
|
return m_borderColor;
|
||||||
@ -1187,6 +1201,7 @@ BaseDesignIntf *BaseDesignIntf::cloneItemWOChild(ItemMode mode, QObject *owner,
|
|||||||
clone->setObjectName(this->objectName());
|
clone->setObjectName(this->objectName());
|
||||||
clone->setItemMode(mode);
|
clone->setItemMode(mode);
|
||||||
clone->objectLoadStarted();
|
clone->objectLoadStarted();
|
||||||
|
clone->setReportSettings(this->reportSettings());
|
||||||
for (int i = 0; i < clone->metaObject()->propertyCount(); i++) {
|
for (int i = 0; i < clone->metaObject()->propertyCount(); i++) {
|
||||||
if (clone->metaObject()->property(i).isWritable())
|
if (clone->metaObject()->property(i).isWritable())
|
||||||
clone->setProperty(clone->metaObject()->property(i).name(), property(clone->metaObject()->property(i).name()));
|
clone->setProperty(clone->metaObject()->property(i).name(), property(clone->metaObject()->property(i).name()));
|
||||||
|
@ -245,7 +245,9 @@ public:
|
|||||||
QColor borderColor() const;
|
QColor borderColor() const;
|
||||||
void setBorderColor(const QColor &borderColor);
|
void setBorderColor(const QColor &borderColor);
|
||||||
void setItemVisible(const bool& value);
|
void setItemVisible(const bool& value);
|
||||||
virtual bool canContainChildren(){ return false;}
|
virtual bool canContainChildren(){ return false;}
|
||||||
|
ReportSettings* reportSettings() const;
|
||||||
|
void setReportSettings(ReportSettings *reportSettings);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
@ -347,6 +349,7 @@ private:
|
|||||||
ItemAlign m_itemAlign;
|
ItemAlign m_itemAlign;
|
||||||
bool m_changingItemAlign;
|
bool m_changingItemAlign;
|
||||||
QColor m_borderColor;
|
QColor m_borderColor;
|
||||||
|
ReportSettings* m_reportSettings;
|
||||||
signals:
|
signals:
|
||||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||||
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||||
|
@ -92,7 +92,8 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
|
|||||||
m_multiSelectStarted(false),
|
m_multiSelectStarted(false),
|
||||||
m_movedItem(0),
|
m_movedItem(0),
|
||||||
m_joinItem(0),
|
m_joinItem(0),
|
||||||
m_magneticMovement(false)
|
m_magneticMovement(false),
|
||||||
|
m_reportSettings(0)
|
||||||
{
|
{
|
||||||
m_reportEditor = dynamic_cast<ReportEnginePrivate *>(parent);
|
m_reportEditor = dynamic_cast<ReportEnginePrivate *>(parent);
|
||||||
updatePageRect();
|
updatePageRect();
|
||||||
@ -1044,6 +1045,17 @@ void PageDesignIntf::changeSelectedGroupProperty(const QString &name, const QVar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReportSettings *PageDesignIntf::getReportSettings() const
|
||||||
|
{
|
||||||
|
return m_reportSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PageDesignIntf::setReportSettings(ReportSettings *reportSettings)
|
||||||
|
{
|
||||||
|
m_reportSettings = reportSettings;
|
||||||
|
m_pageItem->setReportSettings(m_reportSettings);
|
||||||
|
}
|
||||||
|
|
||||||
bool PageDesignIntf::magneticMovement() const
|
bool PageDesignIntf::magneticMovement() const
|
||||||
{
|
{
|
||||||
return m_magneticMovement;
|
return m_magneticMovement;
|
||||||
|
@ -178,6 +178,9 @@ namespace LimeReport {
|
|||||||
bool magneticMovement() const;
|
bool magneticMovement() const;
|
||||||
void setMagneticMovement(bool magneticMovement);
|
void setMagneticMovement(bool magneticMovement);
|
||||||
|
|
||||||
|
ReportSettings *getReportSettings() const;
|
||||||
|
void setReportSettings(ReportSettings *reportSettings);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void keyPressEvent(QKeyEvent *event);
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
@ -309,6 +312,7 @@ namespace LimeReport {
|
|||||||
BaseDesignIntf* m_joinItem;
|
BaseDesignIntf* m_joinItem;
|
||||||
JoinType m_joinType;
|
JoinType m_joinType;
|
||||||
bool m_magneticMovement;
|
bool m_magneticMovement;
|
||||||
|
ReportSettings* m_reportSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractPageCommand : public CommandIf{
|
class AbstractPageCommand : public CommandIf{
|
||||||
|
@ -93,6 +93,7 @@ PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName)
|
|||||||
PageDesignIntf* page =new PageDesignIntf();
|
PageDesignIntf* page =new PageDesignIntf();
|
||||||
page->setObjectName(pageName);
|
page->setObjectName(pageName);
|
||||||
page->setReportEditor(this);
|
page->setReportEditor(this);
|
||||||
|
page->setReportSettings(&m_reportSettings);
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +118,7 @@ void ReportEnginePrivate::collectionLoadFinished(const QString &)
|
|||||||
{
|
{
|
||||||
foreach (PageDesignIntf* page, m_pages) {
|
foreach (PageDesignIntf* page, m_pages) {
|
||||||
page->setReportEditor(this);
|
page->setReportEditor(this);
|
||||||
|
page->setReportSettings(&m_reportSettings);
|
||||||
page->setSceneRect(-Const::SCENE_MARGIN,-Const::SCENE_MARGIN,
|
page->setSceneRect(-Const::SCENE_MARGIN,-Const::SCENE_MARGIN,
|
||||||
page->pageItem()->width()+Const::SCENE_MARGIN*2,
|
page->pageItem()->width()+Const::SCENE_MARGIN*2,
|
||||||
page->pageItem()->height()+Const::SCENE_MARGIN*2);
|
page->pageItem()->height()+Const::SCENE_MARGIN*2);
|
||||||
@ -152,6 +154,7 @@ void ReportEnginePrivate::clearReport()
|
|||||||
m_pages.clear();
|
m_pages.clear();
|
||||||
m_datasources->clear(DataSourceManager::Owned);
|
m_datasources->clear(DataSourceManager::Owned);
|
||||||
m_fileName="";
|
m_fileName="";
|
||||||
|
m_reportSettings.setDefaultValues();
|
||||||
emit cleared();
|
emit cleared();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,6 +562,16 @@ QString ReportEnginePrivate::renderToString()
|
|||||||
}else return QString();
|
}else return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ReportEnginePrivate::suppressFieldAndVarError() const
|
||||||
|
{
|
||||||
|
return m_reportSettings.suppressAbsentFieldsAndVarsWarnings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarError)
|
||||||
|
{
|
||||||
|
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
|
||||||
|
}
|
||||||
|
|
||||||
QString ReportEnginePrivate::previewWindowTitle() const
|
QString ReportEnginePrivate::previewWindowTitle() const
|
||||||
{
|
{
|
||||||
return m_previewWindowTitle;
|
return m_previewWindowTitle;
|
||||||
@ -582,7 +595,7 @@ void ReportEnginePrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon)
|
|||||||
ReportPages ReportEnginePrivate::renderToPages()
|
ReportPages ReportEnginePrivate::renderToPages()
|
||||||
{
|
{
|
||||||
m_reportRender = ReportRender::Ptr(new ReportRender);
|
m_reportRender = ReportRender::Ptr(new ReportRender);
|
||||||
dataManager()->clearErrorsList();
|
dataManager()->clearErrors();
|
||||||
dataManager()->connectAllDatabases();
|
dataManager()->connectAllDatabases();
|
||||||
dataManager()->setDesignTime(false);
|
dataManager()->setDesignTime(false);
|
||||||
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
|
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
|
||||||
@ -590,6 +603,7 @@ ReportPages ReportEnginePrivate::renderToPages()
|
|||||||
if (m_pages.count()){
|
if (m_pages.count()){
|
||||||
emit renderStarted();
|
emit renderStarted();
|
||||||
m_reportRender->setDatasources(dataManager());
|
m_reportRender->setDatasources(dataManager());
|
||||||
|
m_pages.at(0)->setReportSettings(&m_reportSettings);
|
||||||
ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0));
|
ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0));
|
||||||
emit renderFinished();
|
emit renderFinished();
|
||||||
return result;
|
return result;
|
||||||
|
@ -56,6 +56,7 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer
|
|||||||
Q_DECLARE_PUBLIC(ReportEngine)
|
Q_DECLARE_PUBLIC(ReportEngine)
|
||||||
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader())
|
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader())
|
||||||
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
|
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
|
||||||
|
Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError)
|
||||||
friend class PreviewReportWidget;
|
friend class PreviewReportWidget;
|
||||||
public:
|
public:
|
||||||
static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer);
|
static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer);
|
||||||
@ -112,6 +113,9 @@ public:
|
|||||||
QString previewWindowTitle() const;
|
QString previewWindowTitle() const;
|
||||||
void setPreviewWindowTitle(const QString &previewWindowTitle);
|
void setPreviewWindowTitle(const QString &previewWindowTitle);
|
||||||
|
|
||||||
|
bool suppressFieldAndVarError() const;
|
||||||
|
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pagesLoadFinished();
|
void pagesLoadFinished();
|
||||||
void datasourceCollectionLoadFinished(const QString& collectionName);
|
void datasourceCollectionLoadFinished(const QString& collectionName);
|
||||||
@ -158,6 +162,7 @@ private:
|
|||||||
QIcon m_previewWindowIcon;
|
QIcon m_previewWindowIcon;
|
||||||
QString m_previewWindowTitle;
|
QString m_previewWindowTitle;
|
||||||
QPointer<ReportDesignWindow> m_designerWindow;
|
QPointer<ReportDesignWindow> m_designerWindow;
|
||||||
|
ReportSettings m_reportSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user