mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
followTo has been added
followTo has been added
This commit is contained in:
parent
f01c586926
commit
5b95b9b3d6
@ -31,6 +31,7 @@
|
|||||||
#include <QTextLayout>
|
#include <QTextLayout>
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "lrpagedesignintf.h"
|
#include "lrpagedesignintf.h"
|
||||||
@ -57,7 +58,7 @@ namespace LimeReport{
|
|||||||
|
|
||||||
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
||||||
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
|
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
|
||||||
m_allowHTMLInFields(false)
|
m_allowHTMLInFields(false), m_followTo(""), m_follower(0)
|
||||||
{
|
{
|
||||||
m_text = new QTextDocument();
|
m_text = new QTextDocument();
|
||||||
|
|
||||||
@ -265,8 +266,13 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
|
|||||||
setWidth(m_textSize.width() + fakeMarginSize()*2);
|
setWidth(m_textSize.width() + fakeMarginSize()*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_textSize.height()>height()) && (m_autoHeight) ){
|
if (m_textSize.height()>height()) {
|
||||||
setHeight(m_textSize.height()+borderLineSize()*2);
|
if (m_autoHeight)
|
||||||
|
setHeight(m_textSize.height()+borderLineSize()*2);
|
||||||
|
else if (hasFollower() && !content().isEmpty()){
|
||||||
|
follower()->setContent(getTextPart(0,height()));
|
||||||
|
setContent(getTextPart(height(),0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
|
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
|
||||||
}
|
}
|
||||||
@ -353,6 +359,7 @@ void TextItem::setLineSpacing(int value)
|
|||||||
|
|
||||||
void TextItem::initText()
|
void TextItem::initText()
|
||||||
{
|
{
|
||||||
|
if (!m_text) return;
|
||||||
QTextOption to;
|
QTextOption to;
|
||||||
to.setAlignment(m_alignment);
|
to.setAlignment(m_alignment);
|
||||||
|
|
||||||
@ -454,6 +461,66 @@ QString TextItem::formatFieldValue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TextItem::followTo() const
|
||||||
|
{
|
||||||
|
return m_followTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::setFollowTo(const QString &followTo)
|
||||||
|
{
|
||||||
|
if (m_followTo != followTo){
|
||||||
|
QString oldValue = m_followTo;
|
||||||
|
m_followTo = followTo;
|
||||||
|
if (!isLoading()){
|
||||||
|
TextItem* fi = scene()->findChild<TextItem*>(followTo);
|
||||||
|
if (fi && initFollower(followTo)){
|
||||||
|
notify("followTo",oldValue,followTo);
|
||||||
|
} else {
|
||||||
|
m_followTo = "";
|
||||||
|
QMessageBox::critical(
|
||||||
|
0,
|
||||||
|
tr("Error"),
|
||||||
|
tr("TextItem \" %1 \" already has folower \" %2 \" ")
|
||||||
|
.arg(fi->objectName())
|
||||||
|
.arg(fi->follower()->objectName())
|
||||||
|
);
|
||||||
|
notify("followTo",followTo,"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::setFollower(TextItem *follower)
|
||||||
|
{
|
||||||
|
if (!m_follower){
|
||||||
|
m_follower = follower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextItem::hasFollower()
|
||||||
|
{
|
||||||
|
return m_follower != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextItem::initFollower(QString follower)
|
||||||
|
{
|
||||||
|
TextItem* fi = scene()->findChild<TextItem*>(follower);
|
||||||
|
if (fi){
|
||||||
|
if (!fi->hasFollower()){
|
||||||
|
fi->setFollower(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::pageObjectHasBeenLoaded()
|
||||||
|
{
|
||||||
|
if (!m_followTo.isEmpty()){
|
||||||
|
initFollower(m_followTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextItem::ValueType TextItem::valueType() const
|
TextItem::ValueType TextItem::valueType() const
|
||||||
{
|
{
|
||||||
return m_valueType;
|
return m_valueType;
|
||||||
@ -537,6 +604,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const
|
|||||||
Q_UNUSED(pass)
|
Q_UNUSED(pass)
|
||||||
bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
|
bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
|
||||||
(m_textSize.width()>geometry().width()&&autoWidth()) ||
|
(m_textSize.width()>geometry().width()&&autoWidth()) ||
|
||||||
|
m_follower ||
|
||||||
isNeedExpandContent();
|
isNeedExpandContent();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -557,6 +625,7 @@ void TextItem::setAlignment(Qt::Alignment value)
|
|||||||
|
|
||||||
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
||||||
{
|
{
|
||||||
|
|
||||||
QString context=content();
|
QString context=content();
|
||||||
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
|
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
|
||||||
switch(pass){
|
switch(pass){
|
||||||
@ -575,6 +644,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
|||||||
} else {
|
} else {
|
||||||
setContent(context);
|
setContent(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextItem::setAutoHeight(bool value)
|
void TextItem::setAutoHeight(bool value)
|
||||||
@ -611,63 +681,79 @@ bool TextItem::canBeSplitted(int height) const
|
|||||||
return height>(m_text->begin().layout()->lineAt(0).height());
|
return height>(m_text->begin().layout()->lineAt(0).height());
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
|
QString TextItem::getTextPart(int height, int skipHeight){
|
||||||
{
|
|
||||||
int linesHeight=0;
|
int linesHeight=0;
|
||||||
QString tmpText="";
|
int curLine=0;
|
||||||
TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
int textPos=0;
|
||||||
|
|
||||||
for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
|
QTextBlock curBlock = m_text->begin();
|
||||||
for (int i=0;i<it.layout()->lineCount();i++){
|
QString resultText="";
|
||||||
linesHeight+=it.layout()->lineAt(i).height()+lineSpacing();
|
|
||||||
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {
|
if (skipHeight>0){
|
||||||
linesHeight-=it.layout()->lineAt(i).height();
|
for (;curBlock!=m_text->end();curBlock=curBlock.next()){
|
||||||
goto loop_exit;
|
for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
|
||||||
|
linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
|
||||||
|
if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loop_exit:;
|
||||||
|
}
|
||||||
|
|
||||||
|
linesHeight = 0;
|
||||||
|
qDebug()<<curBlock.lineCount();
|
||||||
|
qDebug()<<(curBlock == m_text->end());
|
||||||
|
for (;curBlock!=m_text->end() || curLine<curBlock.lineCount();curBlock=curBlock.next(), curLine=0, resultText+='\n'){
|
||||||
|
for (;curLine<curBlock.layout()->lineCount();curLine++){
|
||||||
|
if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
|
||||||
|
linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
|
||||||
|
if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
|
||||||
|
linesHeight-=curBlock.layout()->lineAt(curLine).height();
|
||||||
|
goto loop_exit1;
|
||||||
}
|
}
|
||||||
tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
|
resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
||||||
|
curBlock.layout()->lineAt(curLine).textLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loop_exit:
|
loop_exit1:;
|
||||||
tmpText.chop(1);
|
|
||||||
|
resultText.chop(1);
|
||||||
|
|
||||||
upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2);
|
|
||||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
||||||
upperPart->setContent(context->extendTextByTags(tmpText,0));
|
return context->extendTextByTags(resultText,textPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::restoreLinksEvent()
|
||||||
|
{
|
||||||
|
if (!followTo().isEmpty()){
|
||||||
|
BaseDesignIntf* pi = dynamic_cast<BaseDesignIntf*>(parentItem());
|
||||||
|
if (pi){
|
||||||
|
foreach (BaseDesignIntf* bi, pi->childBaseItems()) {
|
||||||
|
if (bi->patternName().compare(followTo())==0){
|
||||||
|
TextItem* ti = dynamic_cast<TextItem*>(bi);
|
||||||
|
if (ti){
|
||||||
|
ti->setFollower(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
|
||||||
|
{
|
||||||
|
TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
||||||
|
upperPart->setContent(getTextPart(height,0));
|
||||||
upperPart->initText();
|
upperPart->initText();
|
||||||
|
upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2);
|
||||||
return upperPart;
|
return upperPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
|
BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
|
||||||
{
|
{
|
||||||
TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
|
||||||
int linesHeight=0;
|
bottomPart->setContent(getTextPart(0,height));
|
||||||
int curLine=0;
|
|
||||||
QTextBlock curBlock;
|
|
||||||
|
|
||||||
QString tmpText="";
|
|
||||||
|
|
||||||
for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
|
|
||||||
for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
|
|
||||||
linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
|
|
||||||
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loop_exit:;
|
|
||||||
|
|
||||||
int textPos=0;
|
|
||||||
for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){
|
|
||||||
for (;curLine<curBlock.layout()->lineCount();curLine++){
|
|
||||||
if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
|
|
||||||
tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
|
||||||
curBlock.layout()->lineAt(curLine).textLength()) + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tmpText.chop(1);
|
|
||||||
|
|
||||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
|
||||||
bottomPart->setContent(context->extendTextByTags(tmpText,textPos));
|
|
||||||
bottomPart->initText();
|
bottomPart->initText();
|
||||||
bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2);
|
bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2);
|
||||||
return bottomPart;
|
return bottomPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,15 +32,16 @@
|
|||||||
#include <QGraphicsTextItem>
|
#include <QGraphicsTextItem>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "lritemdesignintf.h"
|
|
||||||
#include <qnamespace.h>
|
|
||||||
|
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
|
#include "lritemdesignintf.h"
|
||||||
|
#include "lritemdesignintf.h"
|
||||||
|
#include "lrpageinitintf.h"
|
||||||
|
|
||||||
namespace LimeReport {
|
namespace LimeReport {
|
||||||
|
|
||||||
class Tag;
|
class Tag;
|
||||||
class TextItem : public LimeReport::ContentItemDesignIntf {
|
class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_ENUMS(AutoWidth)
|
Q_ENUMS(AutoWidth)
|
||||||
Q_ENUMS(AngleType)
|
Q_ENUMS(AngleType)
|
||||||
@ -66,6 +67,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
|
|||||||
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
|
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
|
||||||
Q_PROPERTY(QString format READ format WRITE setFormat)
|
Q_PROPERTY(QString format READ format WRITE setFormat)
|
||||||
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
||||||
|
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
||||||
@ -140,12 +142,25 @@ public:
|
|||||||
ValueType valueType() const;
|
ValueType valueType() const;
|
||||||
void setValueType(const ValueType valueType);
|
void setValueType(const ValueType valueType);
|
||||||
|
|
||||||
|
QSizeF textSize(){ return m_textSize;}
|
||||||
|
QString followTo() const;
|
||||||
|
void setFollowTo(const QString &followTo);
|
||||||
|
void setFollower(TextItem* follower);
|
||||||
|
bool hasFollower();
|
||||||
|
TextItem* follower(){ return m_follower;}
|
||||||
|
bool initFollower(QString follower);
|
||||||
|
|
||||||
|
// IPageInit interface
|
||||||
|
void pageObjectHasBeenLoaded();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLayout();
|
void updateLayout();
|
||||||
bool isNeedExpandContent() const;
|
bool isNeedExpandContent() const;
|
||||||
QString replaceBR(QString text);
|
QString replaceBR(QString text);
|
||||||
QString replaceReturns(QString text);
|
QString replaceReturns(QString text);
|
||||||
int fakeMarginSize();
|
int fakeMarginSize();
|
||||||
|
QString getTextPart(int height, int skipHeight);
|
||||||
|
void restoreLinksEvent();
|
||||||
private:
|
private:
|
||||||
void initText();
|
void initText();
|
||||||
void setTextFont(const QFont &value);
|
void setTextFont(const QFont &value);
|
||||||
@ -174,6 +189,8 @@ private:
|
|||||||
|
|
||||||
QString m_format;
|
QString m_format;
|
||||||
ValueType m_valueType;
|
ValueType m_valueType;
|
||||||
|
QString m_followTo;
|
||||||
|
TextItem* m_follower;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -889,6 +889,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
|
|||||||
if (borderLines()!=0){
|
if (borderLines()!=0){
|
||||||
spaceBorder += borderLineSize();
|
spaceBorder += borderLineSize();
|
||||||
}
|
}
|
||||||
|
restoreLinks();
|
||||||
snapshotItemsLayout();
|
snapshotItemsLayout();
|
||||||
arrangeSubItems(pass, dataManager);
|
arrangeSubItems(pass, dataManager);
|
||||||
if (autoHeight()){
|
if (autoHeight()){
|
||||||
|
@ -76,7 +76,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_itemAlign(DesignedItemAlign),
|
m_itemAlign(DesignedItemAlign),
|
||||||
m_changingItemAlign(false),
|
m_changingItemAlign(false),
|
||||||
m_borderColor(Qt::black),
|
m_borderColor(Qt::black),
|
||||||
m_reportSettings(0)
|
m_reportSettings(0),
|
||||||
|
m_patternName("")
|
||||||
{
|
{
|
||||||
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)) {
|
||||||
@ -672,6 +673,16 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BaseDesignIntf::patternName() const
|
||||||
|
{
|
||||||
|
return m_patternName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseDesignIntf::setPatternName(const QString &patternName)
|
||||||
|
{
|
||||||
|
m_patternName = patternName;
|
||||||
|
}
|
||||||
|
|
||||||
ReportSettings *BaseDesignIntf::reportSettings() const
|
ReportSettings *BaseDesignIntf::reportSettings() const
|
||||||
{
|
{
|
||||||
return m_reportSettings;
|
return m_reportSettings;
|
||||||
@ -737,7 +748,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const
|
|||||||
|
|
||||||
int BaseDesignIntf::borderLineSize() const
|
int BaseDesignIntf::borderLineSize() const
|
||||||
{
|
{
|
||||||
return m_borderLineSize;
|
return 0 /*m_borderLineSize*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDesignIntf::setBorderLineSize(int value)
|
void BaseDesignIntf::setBorderLineSize(int value)
|
||||||
@ -987,6 +998,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseDesignIntf::restoreLinks()
|
||||||
|
{
|
||||||
|
#ifdef HAVE_QT5
|
||||||
|
foreach(QObject * child, children()) {
|
||||||
|
#else
|
||||||
|
foreach(QObject * child, QObject::children()) {
|
||||||
|
#endif
|
||||||
|
BaseDesignIntf *childItem = dynamic_cast<BaseDesignIntf *>(child);
|
||||||
|
if (childItem) {childItem->restoreLinks();}
|
||||||
|
}
|
||||||
|
restoreLinksEvent();
|
||||||
|
}
|
||||||
|
|
||||||
QPainterPath BaseDesignIntf::shape() const
|
QPainterPath BaseDesignIntf::shape() const
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
@ -1229,6 +1253,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName)
|
|||||||
BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent)
|
BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent)
|
||||||
{
|
{
|
||||||
BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent);
|
BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent);
|
||||||
|
clone->setPatternName(this->objectName());
|
||||||
#ifdef HAVE_QT5
|
#ifdef HAVE_QT5
|
||||||
foreach(QObject * child, children()) {
|
foreach(QObject * child, children()) {
|
||||||
#else
|
#else
|
||||||
|
@ -249,6 +249,8 @@ public:
|
|||||||
ReportSettings* reportSettings() const;
|
ReportSettings* reportSettings() const;
|
||||||
void setReportSettings(ReportSettings *reportSettings);
|
void setReportSettings(ReportSettings *reportSettings);
|
||||||
void setZValueProperty(qreal value);
|
void setZValueProperty(qreal value);
|
||||||
|
QString patternName() const;
|
||||||
|
void setPatternName(const QString &patternName);
|
||||||
|
|
||||||
Q_INVOKABLE QString setItemWidth(qreal width);
|
Q_INVOKABLE QString setItemWidth(qreal width);
|
||||||
Q_INVOKABLE QString setItemHeight(qreal height);
|
Q_INVOKABLE QString setItemHeight(qreal height);
|
||||||
@ -258,6 +260,7 @@ public:
|
|||||||
Q_INVOKABLE qreal getItemPosY();
|
Q_INVOKABLE qreal getItemPosY();
|
||||||
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
||||||
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
@ -283,6 +286,8 @@ protected:
|
|||||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||||
virtual void childAddedEvent(BaseDesignIntf* child);
|
virtual void childAddedEvent(BaseDesignIntf* child);
|
||||||
virtual void parentChangedEvent(BaseDesignIntf*);
|
virtual void parentChangedEvent(BaseDesignIntf*);
|
||||||
|
void restoreLinks();
|
||||||
|
virtual void restoreLinksEvent(){}
|
||||||
|
|
||||||
void drawTopLine(QPainter *painter, QRectF rect) const;
|
void drawTopLine(QPainter *painter, QRectF rect) const;
|
||||||
void drawBootomLine(QPainter *painter, QRectF rect) const;
|
void drawBootomLine(QPainter *painter, QRectF rect) const;
|
||||||
@ -359,6 +364,7 @@ private:
|
|||||||
bool m_changingItemAlign;
|
bool m_changingItemAlign;
|
||||||
QColor m_borderColor;
|
QColor m_borderColor;
|
||||||
ReportSettings* m_reportSettings;
|
ReportSettings* m_reportSettings;
|
||||||
|
QString m_patternName;
|
||||||
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);
|
||||||
|
9
limereport/lrpageinitintf.h
Normal file
9
limereport/lrpageinitintf.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef LRPAGEINITINTF_H
|
||||||
|
#define LRPAGEINITINTF_H
|
||||||
|
|
||||||
|
class IPageInit{
|
||||||
|
public:
|
||||||
|
virtual void pageObjectHasBeenLoaded() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LRPAGEINITINTF_H
|
@ -204,7 +204,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
|
|||||||
resetPageNumber(PageReset);
|
resetPageNumber(PageReset);
|
||||||
|
|
||||||
}
|
}
|
||||||
//m_pageCount = 1;
|
|
||||||
m_renderCanceled = false;
|
m_renderCanceled = false;
|
||||||
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
|
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
|
||||||
m_reportFooterHeight = 0;
|
m_reportFooterHeight = 0;
|
||||||
@ -225,9 +224,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
|
|||||||
QMessageBox::critical(0,tr("Error"),exception.what());
|
QMessageBox::critical(0,tr("Error"),exception.what());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearPageMap();
|
clearPageMap();
|
||||||
|
|
||||||
startNewPage();
|
startNewPage();
|
||||||
|
|
||||||
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded);
|
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded);
|
||||||
@ -543,15 +540,21 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
|
|||||||
|
|
||||||
void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
|
void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
|
||||||
{
|
{
|
||||||
|
QList<BaseDesignIntf*> pageItems;
|
||||||
foreach (BaseDesignIntf* item, patternPage->childBaseItems()) {
|
foreach (BaseDesignIntf* item, patternPage->childBaseItems()) {
|
||||||
ItemDesignIntf* id = dynamic_cast<ItemDesignIntf*>(item);
|
ItemDesignIntf* id = dynamic_cast<ItemDesignIntf*>(item);
|
||||||
if (id&&id->itemLocation()==ItemDesignIntf::Page){
|
if (id&&id->itemLocation()==ItemDesignIntf::Page){
|
||||||
BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(),
|
BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(),
|
||||||
m_renderPageItem,
|
m_renderPageItem,
|
||||||
m_renderPageItem);
|
m_renderPageItem);
|
||||||
cloneItem->updateItemSize(m_datasources);
|
pageItems.append(cloneItem);
|
||||||
|
//cloneItem->updateItemSize(m_datasources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_renderPageItem->restoreLinks();
|
||||||
|
foreach(BaseDesignIntf* item, pageItems){
|
||||||
|
item->updateItemSize(m_datasources);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
|
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
|
||||||
@ -978,7 +981,6 @@ void ReportRender::startNewPage()
|
|||||||
renderBand(band);
|
renderBand(band);
|
||||||
}
|
}
|
||||||
checkLostHeadersOnPrevPage();
|
checkLostHeadersOnPrevPage();
|
||||||
|
|
||||||
pasteGroups();
|
pasteGroups();
|
||||||
renderPageItems(m_patternPageItem);
|
renderPageItems(m_patternPageItem);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user