mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-10-13 23:12:35 +03:00
1.1.1
This commit is contained in:
@@ -31,18 +31,37 @@
|
||||
#include "lrdesignelementsfactory.h"
|
||||
#include "lrglobal.h"
|
||||
|
||||
const QString xmlTag ="Data";
|
||||
const QString xmlTag = "Data";
|
||||
const QString xmlTagHeader = "DataHeader";
|
||||
const QString xmlTagFooter = "DataFooter";
|
||||
|
||||
namespace{
|
||||
|
||||
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataBand(owner,parent);
|
||||
}
|
||||
LimeReport::BaseDesignIntf * createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataHeaderBand(owner,parent);
|
||||
}
|
||||
LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::DataFooterBand(owner,parent);
|
||||
}
|
||||
|
||||
bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
|
||||
xmlTag,
|
||||
LimeReport::ItemAttribs(QObject::tr("Data"),LimeReport::bandTAG),
|
||||
createBand
|
||||
);
|
||||
bool registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
|
||||
xmlTagHeader,
|
||||
LimeReport::ItemAttribs(QObject::tr("DataHeader"),LimeReport::bandTAG),
|
||||
createHeader
|
||||
);
|
||||
bool registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
|
||||
xmlTagFooter,
|
||||
LimeReport::ItemAttribs(QObject::tr("DataFooter"),LimeReport::bandTAG),
|
||||
createFooter
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -70,5 +89,19 @@ BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *pare
|
||||
return new DataBand(owner,parent);
|
||||
}
|
||||
|
||||
DataHeaderBand::DataHeaderBand(QObject *owner, QGraphicsItem *parent)
|
||||
:BandDesignIntf(BandDesignIntf::DataHeader,xmlTagHeader,owner,parent)
|
||||
{
|
||||
setBandTypeText(tr("DataHeader"));
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
|
||||
DataFooterBand::DataFooterBand(QObject *owner, QGraphicsItem *parent)
|
||||
:BandDesignIntf(BandDesignIntf::DataFooter,xmlTagFooter,owner,parent)
|
||||
{
|
||||
setBandTypeText(tr("DataFooter"));
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <QObject>
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class DataBand : public DataBandDesignIntf
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -51,5 +52,34 @@ protected:
|
||||
private:
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
};
|
||||
|
||||
class DataHeaderBand : public BandDesignIntf
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const {return false;}
|
||||
bool isHeader() const {return true;}
|
||||
QColor bandColor() const {return QColor(Qt::darkGreen);}
|
||||
private:
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){
|
||||
return new DataHeaderBand(owner,parent);
|
||||
}
|
||||
};
|
||||
|
||||
class DataFooterBand : public BandDesignIntf
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
bool isUnique() const {return false;}
|
||||
bool isFooter() const {return true;}
|
||||
QColor bandColor() const{return QColor(Qt::darkGreen);}
|
||||
private:
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){
|
||||
return new DataFooterBand(owner,parent);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif // LRDATABAND_H
|
||||
|
@@ -88,7 +88,11 @@ BaseDesignIntf *GroupBandHeader::createSameTypeItem(QObject *owner, QGraphicsIte
|
||||
void GroupBandHeader::startGroup()
|
||||
{
|
||||
m_groupStarted=true;
|
||||
|
||||
DataSourceManager* dm = DataSourceManager::instance();
|
||||
QString lineVar = QLatin1String("line_")+objectName().toLower();
|
||||
dm->setReportVariable(lineVar,1);
|
||||
|
||||
if ((dm->dataSource(parentBand()->datasourceName()))){
|
||||
IDataSource* ds = dm->dataSource(parentBand()->datasourceName());
|
||||
if (ds->columnIndexByName(m_groupFiledName)!=-1)
|
||||
@@ -103,11 +107,15 @@ QColor GroupBandHeader::bandColor() const
|
||||
|
||||
bool GroupBandHeader::isNeedToClose()
|
||||
{
|
||||
if (m_groupFieldValue.isNull()) return false;
|
||||
//if (m_groupFieldValue.isNull()) return false;
|
||||
|
||||
DataSourceManager* dm = DataSourceManager::instance();
|
||||
if (!m_groupStarted) return false;
|
||||
DataSourceManager* dm = DataSourceManager::instance();
|
||||
if (m_groupFiledName.isNull() || m_groupFiledName.isEmpty())
|
||||
dm->putError("Group Field Not found");
|
||||
if ((dm->dataSource(parentBand()->datasourceName()))){
|
||||
IDataSource* ds = dm->dataSource(parentBand()->datasourceName());
|
||||
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
||||
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
||||
}
|
||||
|
||||
@@ -116,7 +124,7 @@ bool GroupBandHeader::isNeedToClose()
|
||||
|
||||
bool GroupBandHeader::isStarted()
|
||||
{
|
||||
return !m_groupFieldValue.isNull();
|
||||
return m_groupStarted;//!m_groupFieldValue.isNull();
|
||||
}
|
||||
|
||||
void GroupBandHeader::closeGroup()
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class GroupBandHeader : public BandDesignIntf, public IGropBand{
|
||||
class GroupBandHeader : public BandDesignIntf, public IGroupBand{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString groupFieldName READ groupFieldName WRITE setGroupFieldName)
|
||||
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
|
||||
|
@@ -108,6 +108,7 @@ QColor SubDetailBand::bandColor() const
|
||||
SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent)
|
||||
:BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent), m_printAlways(false)
|
||||
{
|
||||
setBandTypeText(tr("SubDetailHeader"));
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
|
||||
|
@@ -56,13 +56,13 @@ class SubDetailHeaderBand : public BandDesignIntf
|
||||
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
|
||||
public:
|
||||
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
virtual bool isUnique() const;
|
||||
bool isUnique() const;
|
||||
void setPrintAlways(bool value){m_printAlways=value;}
|
||||
bool printAlways(){return m_printAlways;}
|
||||
protected:
|
||||
virtual QColor bandColor() const;
|
||||
QColor bandColor() const;
|
||||
private:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
private:
|
||||
bool m_printAlways;
|
||||
};
|
||||
@@ -76,11 +76,11 @@ public:
|
||||
void setPrintAlways(bool value){m_printAlways=value;}
|
||||
bool printAlways(){return m_printAlways;}
|
||||
virtual bool isUnique() const;
|
||||
virtual bool isFooter() const{return true;}
|
||||
bool isFooter() const{return true;}
|
||||
protected:
|
||||
virtual QColor bandColor() const;
|
||||
QColor bandColor() const;
|
||||
private:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
private:
|
||||
bool m_printAlways;
|
||||
};
|
||||
|
Reference in New Issue
Block a user