From 54c5bc65edc847968ac7ed94a860c087ce487958 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 18 Aug 2017 22:55:29 +0300 Subject: [PATCH 1/3] TOC has been added --- limereport/lrbanddesignintf.h | 1 + limereport/lrdatadesignintf.cpp | 1 + limereport/lrdatasourcemanager.cpp | 1 + limereport/lrpageitemdesignintf.cpp | 34 ++++- limereport/lrpageitemdesignintf.h | 12 ++ limereport/lrreportengine.cpp | 34 ++++- limereport/lrreportengine_p.h | 2 +- limereport/lrreportrender.cpp | 15 +- limereport/lrscriptenginemanager.cpp | 129 +++++++++++++++++- limereport/lrscriptenginemanager.h | 32 ++++- .../editors/lrbuttonlineeditor.cpp | 1 + 11 files changed, 241 insertions(+), 21 deletions(-) diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 92a171d..4e205cb 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -240,6 +240,7 @@ public: qreal bottomSpace() const; signals: void bandRendered(BandDesignIntf* band); + void bandRegistred(); protected: void trimToMaxHeight(int maxHeight); void setBandTypeText(const QString& value); diff --git a/limereport/lrdatadesignintf.cpp b/limereport/lrdatadesignintf.cpp index 2bc5e3a..9f5e64d 100644 --- a/limereport/lrdatadesignintf.cpp +++ b/limereport/lrdatadesignintf.cpp @@ -687,6 +687,7 @@ bool CallbackDatasource::prior(){ void CallbackDatasource::first(){ m_currentRow = 0; + m_getDataFromCache = false; m_eof=checkIfEmpty(); bool result=false; diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 6ff7d9e..83b438c 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -389,6 +389,7 @@ QSharedPointerDataSourceManager::previewSQL(const QString &c void DataSourceManager::updateDatasourceModel() { m_datasourcesModel.updateModel(); + emit datasourcesChanged(); m_needUpdate = false; } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 2f8f3ff..72c4327 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -50,7 +50,7 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) : m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), - m_isExtendedInDesignMode(false), m_extendedHeight(1000) + m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -63,7 +63,7 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0), m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), - m_isExtendedInDesignMode(false), m_extendedHeight(1000) + m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -331,6 +331,36 @@ void PageItemDesignIntf::initColumnsPos(QVector &posByColumns, qreal pos, } } +QString PageItemDesignIntf::initScript() const +{ + return m_initScript; +} + +void PageItemDesignIntf::setInitScript(const QString& value) +{ + if (m_initScript.compare(value) != 0){ + QString old_value = m_initScript; + m_initScript = value; + if (!isLoading()) + notify("initScript", old_value, value); + } +} + +bool PageItemDesignIntf::getIsTOC() const +{ + return m_isTOC; +} + +void PageItemDesignIntf::setIsTOC(bool isTOC) +{ + if (m_isTOC != isTOC){ + m_isTOC = isTOC; + if (!isLoading()){ + notify("pageIsTOC", !isTOC, isTOC); + } + } +} + int PageItemDesignIntf::extendedHeight() const { return m_extendedHeight; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index f488b07..3910d75 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -55,6 +55,8 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) Q_PROPERTY(bool isExtendedInDesignMode READ isExtendedInDesignMode WRITE setExtendedInDesignMode) Q_PROPERTY(int extendedHeight READ extendedHeight WRITE setExtendedHeight) + Q_PROPERTY(bool pageIsTOC READ getIsTOC WRITE setIsTOC) + Q_PROPERTY(QString initScript READ initScript WRITE setInitScript) friend class ReportRender; public: enum Orientation { Portrait, Landscape }; @@ -126,6 +128,14 @@ public: int extendedHeight() const; void setExtendedHeight(int extendedHeight); + bool getIsTOC() const; + void setIsTOC(bool isTOC); + + QString initScript() const; + void setInitScript(const QString& value); +signals: + void beforeFirstPageRendered(); + void afterLastPageRendered(); protected slots: void bandDeleted(QObject* band); void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); @@ -156,6 +166,8 @@ private: bool m_resetPageNumber; bool m_isExtendedInDesignMode; int m_extendedHeight; + bool m_isTOC; + QString m_initScript; }; typedef QList ReportPages; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 50d1d48..eb23fab 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -574,7 +574,7 @@ void ReportEnginePrivate::designReport() m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); m_designerWindow->setShowProgressDialog(m_showProgressDialog); } - + m_datasources->updateDatasourceModel(); #ifdef Q_OS_WIN m_designerWindow->setWindowModality(Qt::ApplicationModal); #endif @@ -893,22 +893,41 @@ ReportPages ReportEnginePrivate::renderToPages() m_reportRender->setScriptContext(scriptContext()); foreach (PageDesignIntf* page, m_pages) { - scriptContext()->baseDesignIntfToScript(page->pageItem()); + scriptContext()->baseDesignIntfToScript(page->pageItem()->objectName(), page->pageItem()); } if (m_scriptEngineContext->runInitScript()){ emit renderStarted(); foreach(PageDesignIntf* page , m_pages){ - page->setReportSettings(&m_reportSettings); - result.append(m_reportRender->renderPageToPages(page)); + if (!page->pageItem()->getIsTOC()){ + page->setReportSettings(&m_reportSettings); + result.append(m_reportRender->renderPageToPages(page)); + } + } + + bool isFirst = true; + + foreach(PageDesignIntf* page , m_pages){ + if (page->pageItem()->getIsTOC()){ + page->setReportSettings(&m_reportSettings); + if (isFirst){ + ReportPages pages = m_reportRender->renderPageToPages(page); + for (int i=0; irenderPageToPages(page)); + } + isFirst = false; } m_reportRender->secondRenderPass(result); emit renderFinished(); m_reportRender.clear(); - m_reportRendering = false; } + m_reportRendering = false; activateLanguage(QLocale::AnyLanguage); return result; } else { @@ -1145,5 +1164,10 @@ ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent) connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); } +ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){ + ScriptEngineManager::instance().setDataManager(dataManager()); + return &ScriptEngineManager::instance(); +} + }// namespace LimeReport diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index c8d6307..29d0aa3 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -78,7 +78,7 @@ public: int pageCount() {return m_pages.count();} DataSourceManager* dataManager(){return m_datasources;} ScriptEngineContext* scriptContext(){return m_scriptEngineContext;} - ScriptEngineManager* scriptManager(){return &ScriptEngineManager::instance();} + ScriptEngineManager* scriptManager(); IDataSourceManager* dataManagerIntf(){return m_datasources;} IScriptEngineManager* scriptManagerIntf(){ diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 5af0b3d..710b5f5 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -982,6 +982,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) if (band->isData()) m_renderedDataBandCount++; band->setObjectName(band->objectName()+QString::number(++m_curentNameIndex)); renameChildItems(band); + if (m_lastDataBand) + emit m_lastDataBand->bandRegistred(); return true; } else return false; } @@ -1065,7 +1067,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) { BandDesignIntf* bandClone = dynamic_cast(patternBand->cloneItem(PreviewMode)); - m_scriptEngineContext->baseDesignIntfToScript(bandClone); + m_scriptEngineContext->baseDesignIntfToScript(patternBand->page()->pageItem()->objectName(), bandClone); emit(patternBand->beforeRender()); if (patternBand->isFooter()){ @@ -1078,7 +1080,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand) bandClone->updateItemSize(m_datasources); - m_scriptEngineContext->baseDesignIntfToScript(bandClone); + //m_scriptEngineContext->baseDesignIntfToScript(bandClone); emit(patternBand->afterData()); return bandClone; @@ -1101,7 +1103,7 @@ void ReportRender::startNewPage(bool isFirst) initColumns(); initRenderPage(); - m_scriptEngineContext->baseDesignIntfToScript(m_renderPageItem); + m_scriptEngineContext->baseDesignIntfToScript(m_renderPageItem->patternName(), m_renderPageItem); m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount)); m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height(); @@ -1110,7 +1112,11 @@ void ReportRender::startNewPage(bool isFirst) emit m_patternPageItem->beforeRender(); - if (isFirst) renderReportHeader(m_patternPageItem, BeforePageHeader); + if (isFirst) { + renderReportHeader(m_patternPageItem, BeforePageHeader); + emit m_patternPageItem->beforeFirstPageRendered(); + } + renderPageHeader(m_patternPageItem); m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem); @@ -1303,6 +1309,7 @@ void ReportRender::savePage(bool isLast) moveTearOffBand(); emit m_patternPageItem->afterRender(); + if (isLast) emit m_patternPageItem->afterLastPageRendered(); } diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 11b4cbc..5f18bc8 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -201,6 +201,8 @@ ScriptEngineManager::~ScriptEngineManager() { delete m_model; m_model = 0; + delete m_tableOfContens; + m_tableOfContens = 0; delete m_scriptEngine; } @@ -342,8 +344,10 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); addFunction(describer); - } + ICallbackDatasource* tableOfContens = m_dataManager->createCallbackDatasource("tableofcontens"); + connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), + m_tableOfContens, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); } } } @@ -534,6 +538,11 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){ return QVariant(); } +void ScriptEngineManager::addTableOfContensItem(const QString& content, int pageNumber, int indent) +{ + m_tableOfContens->setItem(content, pageNumber, indent); +} + void ScriptEngineManager::updateModel() { @@ -740,6 +749,36 @@ bool ScriptEngineManager::createGetFieldFunction() return addFunction(fd); } +bool ScriptEngineManager::createAddTableOfContensItemFunction() +{ + JSFunctionDesc fd; + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory(tr("GENERAL")); + fd.setName("addTableOfContensItem"); + fd.setDescription("addTableOfContensItem(\""+tr("Content")+"\", \""+tr("Page Number")+", \""+tr("Indent")+"\")"); + fd.setScriptWrapper(QString("function addTableOfContensItem(content, pageNumber, indent){" + "return %1.addTableOfContensItem(content, pageNumber, indent);}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + +bool ScriptEngineManager::createClearTableOfContensFunction() +{ + JSFunctionDesc fd; + fd.setManager(m_functionManager); + fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); + fd.setCategory(tr("GENERAL")); + fd.setName("clearTableOfContens"); + fd.setDescription("clearTableOfContens()"); + fd.setScriptWrapper(QString("function clearTableOfContens(){" + "return %1.clearTableOfContens();}" + ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) + ); + return addFunction(fd); +} + ScriptEngineManager::ScriptEngineManager() :m_model(0), m_dataManager(0) { @@ -770,8 +809,11 @@ ScriptEngineManager::ScriptEngineManager() QScriptValue fontConstructor = m_scriptEngine->newFunction(QFontPrototype::constructorQFont, fontProto); m_scriptEngine->globalObject().setProperty("QFont", fontConstructor); #endif - m_model = new ScriptEngineModel(this); + createAddTableOfContensItemFunction(); + createClearTableOfContensFunction(); + m_model = new ScriptEngineModel(this); + m_tableOfContens = new TableOfContens(); } bool ScriptExtractor::parse() @@ -1118,10 +1160,9 @@ QString ScriptEngineContext::getNewDialogName() #endif -void ScriptEngineContext::baseDesignIntfToScript(BaseDesignIntf* item) +void ScriptEngineContext::baseDesignIntfToScript(const QString& pageName, BaseDesignIntf* item) { if ( item ) { - if (item->metaObject()->indexOfSignal("beforeRender()")!=-1) item->disconnect(SIGNAL(beforeRender())); if (item->metaObject()->indexOfSignal("afterData()")!=-1) @@ -1134,9 +1175,9 @@ void ScriptEngineContext::baseDesignIntfToScript(BaseDesignIntf* item) #ifdef USE_QJSENGINE //sItem = engine->newQObject(item); ScriptValueType sItem = getCppOwnedJSValue(*engine, item); - engine->globalObject().setProperty(item->patternName(), sItem); + engine->globalObject().setProperty(pageName+"_"+item->patternName(), sItem); #else - ScriptValueType sItem = engine->globalObject().property(item->patternName()); + ScriptValueType sItem = engine->globalObject().property(pageName+"_"+item->patternName()); if (sItem.isValid()){ engine->newQObject(sItem, item); } else { @@ -1145,7 +1186,7 @@ void ScriptEngineContext::baseDesignIntfToScript(BaseDesignIntf* item) } #endif foreach(BaseDesignIntf* child, item->childBaseItems()){ - baseDesignIntfToScript(child); + baseDesignIntfToScript(pageName, child); } } } @@ -1179,6 +1220,7 @@ void ScriptEngineContext::initDialogs(){ bool ScriptEngineContext::runInitScript(){ ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine(); + ScriptEngineManager::instance().clearTableOfContens(); #ifndef USE_QJSENGINE engine->pushContext(); #endif @@ -1376,6 +1418,16 @@ QVariant ScriptFunctionsManager::getField(const QString &field) return dm->fieldData(field); } +void ScriptFunctionsManager::addTableOfContensItem(const QString& content, int pageNumber, int indent) +{ + scriptEngineManager()->addTableOfContensItem(content, pageNumber, indent); +} + +void ScriptFunctionsManager::clearTableOfContens() +{ + scriptEngineManager()->clearTableOfContens(); +} + #ifdef USE_QJSENGINE QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool bold, bool italic, bool underLine) { @@ -1413,5 +1465,68 @@ void ScriptFunctionsManager::setScriptEngineManager(ScriptEngineManager *scriptE m_scriptEngineManager = scriptEngineManager; } +TableOfContens::~TableOfContens() +{ + clear(); +} + +void TableOfContens::setItem(const QString& content, int pageNumber, int indent) +{ + ContentItem * item = 0; + if (m_hash.contains(content)){ + ContentItem* item = m_hash.value(content); + item->pageNumber = pageNumber; + item->indent = indent; + } else { + ContentItem* item = new ContentItem; + item->content = content; + item->pageNumber = pageNumber; + item->indent = indent; + + m_tableOfContens.append(item); + m_hash.insert(content, item); + } + +} + +void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data) +{ + QStringList columns; + columns << "Content" << "Page number"; + + switch (info.dataType) { + case LimeReport::CallbackInfo::RowCount: + data = m_tableOfContens.count(); + break; + case LimeReport::CallbackInfo::ColumnCount: + data = columns.size(); + break; + case LimeReport::CallbackInfo::ColumnHeaderData: { + data = columns.at(info.index); + break; + } + case LimeReport::CallbackInfo::ColumnData: + if (info.index < m_tableOfContens.count()){ + ContentItem* item = m_tableOfContens.at(info.index); + if (info.columnName == "Content") + data = item->content.rightJustified(item->indent+item->content.size()); + else + data = QString::number(item->pageNumber); + } + break; + default: break; + } +} + +void LimeReport::TableOfContens::clear(){ + + m_hash.clear(); + foreach(ContentItem* item, m_tableOfContens){ + delete item; + } + m_tableOfContens.clear(); + +} + } //namespace LimeReport diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 2e5786f..7e46490 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -49,6 +49,7 @@ #include "base/lrsingleton.h" #include "lrglobal.h" #include "lrscriptenginemanagerintf.h" +#include "lrcallbackdatasourceintf.h" #include "lrcollection.h" namespace LimeReport{ @@ -56,6 +57,26 @@ namespace LimeReport{ class DataSourceManager; class BaseDesignIntf; +struct ContentItem { + QString content; + int indent; + int pageNumber; +}; + +class TableOfContens : public QObject{ + Q_OBJECT +public: + ~TableOfContens(); + void setItem(const QString& content, int pageNumber, int indent = 0); + void clear(); +private slots: + void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data); +private: + QVector m_tableOfContens; + QHash m_hash; +}; + + struct ScriptFunctionDesc{ enum FuncType {Native,Script}; ScriptValueType scriptValue; @@ -156,7 +177,7 @@ public: QString getNewDialogName(); void initDialogs(); #endif - void baseDesignIntfToScript(BaseDesignIntf *item); + void baseDesignIntfToScript(const QString& pageName, BaseDesignIntf *item); void clear(); QString initScript() const; void setInitScript(const QString& initScript); @@ -242,7 +263,9 @@ public: Q_INVOKABLE void setVariable(const QString& name, QVariant value); Q_INVOKABLE QVariant getVariable(const QString& name); Q_INVOKABLE QVariant getField(const QString& field); - Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} + Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} + Q_INVOKABLE void addTableOfContensItem(const QString& content, int pageNumber, int indent = 0); + Q_INVOKABLE void clearTableOfContens(); #ifdef USE_QJSENGINE Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false); #endif @@ -282,6 +305,8 @@ public: QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem); QString expandScripts(QString context, QVariant &varValue, QObject* reportItem); QVariant evaluateScript(const QString &script); + void addTableOfContensItem(const QString& content, int pageNumber, int indent); + void clearTableOfContens(){ m_tableOfContens->clear(); } protected: void updateModel(); @@ -300,6 +325,8 @@ private: bool createSetVariableFunction(); bool createGetVariableFunction(); bool createGetFieldFunction(); + bool createAddTableOfContensItemFunction(); + bool createClearTableOfContensFunction(); private: ScriptEngineManager(); ScriptEngineType* m_scriptEngine; @@ -309,6 +336,7 @@ private: ScriptEngineContext* m_context; DataSourceManager* m_dataManager; ScriptFunctionsManager* m_functionManager; + TableOfContens* m_tableOfContens; }; class ScriptExtractor diff --git a/limereport/objectinspector/editors/lrbuttonlineeditor.cpp b/limereport/objectinspector/editors/lrbuttonlineeditor.cpp index 4f1bc64..8459594 100644 --- a/limereport/objectinspector/editors/lrbuttonlineeditor.cpp +++ b/limereport/objectinspector/editors/lrbuttonlineeditor.cpp @@ -131,6 +131,7 @@ void ButtonLineEditor::editingByEditorFinished() { setText(qobject_cast(sender())->text()); m_lineEdit->setFocus(); + emit editingFinished(); } } //namespace LimeReport From f68a8fff65957675d8f9e0ab467fd7107c6b10f1 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 19 Aug 2017 01:16:57 +0300 Subject: [PATCH 2/3] addTableOfContensItem function has been modified --- limereport/lrpageitemdesignintf.cpp | 15 ------------- limereport/lrpageitemdesignintf.h | 5 ----- limereport/lrreportdesignwidget.cpp | 5 +++++ limereport/lrscriptenginemanager.cpp | 32 ++++++++++++++-------------- limereport/lrscriptenginemanager.h | 6 +++--- 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 72c4327..95b9144 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -331,21 +331,6 @@ void PageItemDesignIntf::initColumnsPos(QVector &posByColumns, qreal pos, } } -QString PageItemDesignIntf::initScript() const -{ - return m_initScript; -} - -void PageItemDesignIntf::setInitScript(const QString& value) -{ - if (m_initScript.compare(value) != 0){ - QString old_value = m_initScript; - m_initScript = value; - if (!isLoading()) - notify("initScript", old_value, value); - } -} - bool PageItemDesignIntf::getIsTOC() const { return m_isTOC; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 3910d75..c39788a 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -56,7 +56,6 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft Q_PROPERTY(bool isExtendedInDesignMode READ isExtendedInDesignMode WRITE setExtendedInDesignMode) Q_PROPERTY(int extendedHeight READ extendedHeight WRITE setExtendedHeight) Q_PROPERTY(bool pageIsTOC READ getIsTOC WRITE setIsTOC) - Q_PROPERTY(QString initScript READ initScript WRITE setInitScript) friend class ReportRender; public: enum Orientation { Portrait, Landscape }; @@ -130,9 +129,6 @@ public: bool getIsTOC() const; void setIsTOC(bool isTOC); - - QString initScript() const; - void setInitScript(const QString& value); signals: void beforeFirstPageRendered(); void afterLastPageRendered(); @@ -167,7 +163,6 @@ private: bool m_isExtendedInDesignMode; int m_extendedHeight; bool m_isTOC; - QString m_initScript; }; typedef QList ReportPages; diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 738dedc..285622f 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -237,6 +237,8 @@ void ReportDesignWidget::createTabs(){ connectPage(m_report->pageAt(i)); pageIndex = m_tabWidget->addTab(view,QIcon(),m_report->pageAt(i)->pageItem()->objectName()); m_tabWidget->setTabWhatsThis(pageIndex, "page"); + connect(m_report->pageAt(i)->pageItem(), SIGNAL(propertyObjectNameChanged(QString,QString)), + this, SLOT(slotPagePropertyObjectNameChanged(QString,QString))); } m_scriptEditor = new QTextEdit(this); @@ -827,6 +829,9 @@ void ReportDesignWidget::slotPagePropertyObjectNameChanged(const QString &oldVal void ReportDesignWidget::slotTabMoved(int from, int to) { + Q_UNUSED(from) + Q_UNUSED(to) + QList pages; for ( int i = 0; i < m_tabWidget->tabBar()->count(); ++i){ diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 5f18bc8..b0ca34c 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -538,9 +538,9 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){ return QVariant(); } -void ScriptEngineManager::addTableOfContensItem(const QString& content, int pageNumber, int indent) +void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent) { - m_tableOfContens->setItem(content, pageNumber, indent); + m_tableOfContens->setItem(uniqKey, content, pageNumber, indent); } void ScriptEngineManager::updateModel() @@ -756,9 +756,9 @@ bool ScriptEngineManager::createAddTableOfContensItemFunction() fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME); fd.setCategory(tr("GENERAL")); fd.setName("addTableOfContensItem"); - fd.setDescription("addTableOfContensItem(\""+tr("Content")+"\", \""+tr("Page Number")+", \""+tr("Indent")+"\")"); - fd.setScriptWrapper(QString("function addTableOfContensItem(content, pageNumber, indent){" - "return %1.addTableOfContensItem(content, pageNumber, indent);}" + fd.setDescription("addTableOfContensItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Page Number")+", \""+tr("Indent")+"\")"); + fd.setScriptWrapper(QString("function addTableOfContensItem(uniqKey, content, pageNumber, indent){" + "return %1.addTableOfContensItem(uniqKey, content, pageNumber, indent);}" ).arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); return addFunction(fd); @@ -1418,9 +1418,9 @@ QVariant ScriptFunctionsManager::getField(const QString &field) return dm->fieldData(field); } -void ScriptFunctionsManager::addTableOfContensItem(const QString& content, int pageNumber, int indent) +void ScriptFunctionsManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent) { - scriptEngineManager()->addTableOfContensItem(content, pageNumber, indent); + scriptEngineManager()->addTableOfContensItem(uniqKey, content, pageNumber, indent); } void ScriptFunctionsManager::clearTableOfContens() @@ -1470,21 +1470,21 @@ TableOfContens::~TableOfContens() clear(); } -void TableOfContens::setItem(const QString& content, int pageNumber, int indent) +void TableOfContens::setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent) { ContentItem * item = 0; - if (m_hash.contains(content)){ - ContentItem* item = m_hash.value(content); - item->pageNumber = pageNumber; - item->indent = indent; - } else { - ContentItem* item = new ContentItem; + if (m_hash.contains(uniqKey)){ + item = m_hash.value(uniqKey); + item->content = content; + item->pageNumber = pageNumber; + item->indent = indent; + } else { + item = new ContentItem; item->content = content; item->pageNumber = pageNumber; item->indent = indent; - m_tableOfContens.append(item); - m_hash.insert(content, item); + m_hash.insert(uniqKey, item); } } diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 7e46490..fa55a45 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -67,7 +67,7 @@ class TableOfContens : public QObject{ Q_OBJECT public: ~TableOfContens(); - void setItem(const QString& content, int pageNumber, int indent = 0); + void setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0); void clear(); private slots: void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data); @@ -264,7 +264,7 @@ public: Q_INVOKABLE QVariant getVariable(const QString& name); Q_INVOKABLE QVariant getField(const QString& field); Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);} - Q_INVOKABLE void addTableOfContensItem(const QString& content, int pageNumber, int indent = 0); + Q_INVOKABLE void addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0); Q_INVOKABLE void clearTableOfContens(); #ifdef USE_QJSENGINE Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false); @@ -305,7 +305,7 @@ public: QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem); QString expandScripts(QString context, QVariant &varValue, QObject* reportItem); QVariant evaluateScript(const QString &script); - void addTableOfContensItem(const QString& content, int pageNumber, int indent); + void addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent); void clearTableOfContens(){ m_tableOfContens->clear(); } protected: From 9f2bfc66d77cea48db91b43ae75b9f3f2da6e650 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 19 Aug 2017 01:33:10 +0300 Subject: [PATCH 3/3] TOC demo has been added --- ...t1_report_header_group_subdetail_TOC.lrxml | 1139 +++++++++++++++++ 1 file changed, 1139 insertions(+) create mode 100644 demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml diff --git a/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml b/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml new file mode 100644 index 0000000..ca60553 --- /dev/null +++ b/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml @@ -0,0 +1,1139 @@ + + + + + + + page2 + + + + + + + + TOC + + + + DataBand1 + + + + TextItem1 + + + + + DataBand1 + + + + + + + $D{tableofcontens.Content} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem2 + + + + + DataBand1 + + + + + + + $D{tableofcontens.Page number} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TOC + + + + + + + + + + + tableofcontens + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page1 + + + + + + + + ReportPage1 + + + + ReportHeader1 + + + + TextItem1 + + + + + ReportHeader1 + + + + + + + Lime +Report + + + + + + + + + + + + + + + + + + + + + + + + + + + ImageItem1 + + + + + ReportHeader1 + + + + + + + 89504e470d0a1a0a0000000d494844520000006400000071080600000023f9067c000000097048597300000dd700000dd70142289b780000119c49444154789ced9d79701cd59dc73feff55cba46b7c18eed8d84c1b6c02c4636b58ea928d8c609b0bb64c3429104ca5420b001c292cd3ae50d7120091bbb300e570a0c2609391c0889b99c1828b0036c42488c8d8d1cf9968c25d91aeb1849a3397afa78fb47cf48e383b2248f3c9a91be5553d3d3afbbe7757ffbbddfeffd8ef704a780dfef07104208745d17a73a7e1c83871002c330304d13c00638e503deb871a36bf1e2c5771886e1374d5328a546ba9e630642086f2010f8d3b469d35ec7e1c2729deaa44020e002beee72b9ced6340da5d4782b49135c2e577e28145a0b6c077a80e82909e9eaea12b66d8b6834aaaf5cb9f2059fcf67bb5c2e4388715e868b4824622e58b060e6a5975eba2810084c00a602fb180421a2b7b7570098a669ad58b1621b70180802d688d63ab711abadadfdbc94b2ce344d17e00524c0295b4812524a05f402078056c0601032681c274001d1d9b367cf9152da899e46e13c4b31684212308128104e6c8f6378b04b4b4b63272b182a2149a894cf38860129e5c9f79fe17a8ce31418276494619c905186e1ca9013a094e2b8b1c9b806360c199b36428410ac59b3068fc7a3b5b5b5b9bababa4428143a9ea49c47d23ed5d8d8686fdebcd92461a31a2cd24608c0c2850b7d555555cb84105f554a598ccd56226ddb8eb6b4b43c595d5dfd108e5818f41021ad843cf0c003f1bababab57bf6ec79aba9a9a9c2300c4f3aaf9f0d104208cbb2ac8f3efa28004c04dac904215eaf97b56bd7aab56bd776242a509cb8fe586b25c9f1591c88e0989804839427692344d7f56465e240178ef5722c43e190613104e19e36426ebdf5569e7aeaa964454cc64d2b082150437420a58d90a79e7a0aa514efbfff3eab57af1e6bddd431b02c8bbd7bf7aa1d3b760cf9dcb40af59e9e1e317dfaf4090f3ffc70795f5f9fb42c6b4c12a394b21b1b1b3bafbcf2ca761cb5f7cc7759008140c05b5555f5359fcf779bdfef5763d1bb2884909665450dc3580bfc08a7eb36067b7eda0859b06001d3a74fd78195c033c0598087b1a76541c2e721a5acb46d3b309413d346c8e6cd9b939b16d08df356b8187b26faa48a6bd8b6ddc710959bb476590c6858a1c4672cb68e54d864ca7492625c5443ad44aec2e7f3118b9dd431f8b148ab71f1b5d75ea3a4a4c4130c06dddddddda2afaf6fccb590847151eddab5cb7cf4d147e389dd99d1b2ce39e79c7ee3a26ddb63dab8d8dadafae4a38f3efa50625f668c8bf7dd775fbcaeae6ecdae5dbbde3874e85085aeeb1e31d6ecef806ddb564b4b4b07703699322e161414b06edd3ab56eddba2e1c197214d0d275fd2c4252cbd2851091841b62d0481b21e1709844450c9c40ba1ec6669705098baf52ca66880185692364f7eeddcc98312359199381e0afb186fefbcecfcf27128964c6b83863c60c945284c361d78e1d3bdcb66dd3d1d131e644881002d33469686830972f5f9e941d99d1b2745d777b3c9e2f5e72c9255799a6698f455b168e96a55f78e1851b962f5fbe9e449ac1604f4e2b211b366c50b5b5b507dadbdbff1608048ae2f1b89b2178cb720022d1428cfafa7a1ba8648881e9692364e6cc995c7bedb516b0056804ca0177baae9f6550802ea554b66d674686ecdab52b591113c7853bd66d59966ddb0619362e82330689e3a8bf63a5ab3a1ec96e3a738172c761ac47c60ffbdec7637b4719c60919651895849c247226db9403c731348c14f2919221a7052104adadad1228080402aeaeae2e2984c80a992484108661a88686065d08116588f274541202e0f7fb27e4e7e7ff72c284093312ba7c56b49244d449a4babafac96f7ce31b8f3030141814462d21f7dd775fd7942953beb67dfbf6a99d9d9d2596656585295f08816559768a3fe428d94ec8d2a54b59b56a958993131f05f271e45d56b4129cb19821840867cc1f924eac5ab50a9c9b8ae1bc6182ec21230995202373093b23802185618e420cb9eea352edede93926934165eb2767d4dee2e26294526cd9b2456cd8b0411ac6a04363338e8450a7bebe5e2554f5cc587bd38d7038ecaea9a939b7aaaaaa3012896493fc10b66d5b4d4d4d6dafbefaea61ce60f4fb097fb264c9127efef39f9fc62507609a66797e7efe8352ca595eaf17b247a80bdbb663c160f027c0c33856ef918d7eafacaca4a1a1a1f0e8d1a3de482422a2d1a8d075ddb8fcf2cbfb18620ad7c9b06cd9324a4a4a8e02d700938032b22b705b0171b7db5d6e18c6d1a19c382c42962d5be6292d2d5d5b565676594272d9e170f843e0cb38898e3aa7f1f056ae5c090331c2dd89eb659b2bd8300c23c299705099a629955213344d3b0b48469b848099c01e1c07d5e93ebc64026932c62b9bc848be3c4356db874548381c3e7e324c158bc5bc38ddcb41d2d7df67f33450c3aaf3b0083959ac956ddb9263f3d2d3d9c5642321c3c2a81c188e658c1332ca907142dc19afc1e8c219893ab9f762b4da4a64811b615a1034503fdc86f56117b691620bfde3bfc0c2dfc3d042cb720be924a49f849716e3bdb01caf5be2366c8a8a3d7c420a2a04e4d90a6528621797d3da1aa1cd52e85183d89fdb885eb681380965604609ecee4e63edb204e9214408a46dca7228bc773ee72d9acc055e8d85122e9282a9273b65820fa6158361531f3579775a31af4d29e2fd8e183df7be4f647777d69bde8785d327c48c23224151d9f466d95faee1bfce2d67e6604f15804732cbe36156b187dbaafd341f8ef0649ec66fdf0d70f8a583843501961a3bc40c8b903e7c0acb8058103e781136de4f61a0a5e0dc0a669ecea3f348a67cb290fbefba80db3f33891fe8162fbfda4c72fead3141ca500951000b8ffcc6cf960945bcf1001cdae34ca0e1e1844766296c4b61db0a4b2994022500211002a426909ac475fc30d3ab31694e254f3c5dc7e2a5efb1fcd7fb69c4b167e57cfefb500991f75ccc9485d6f65bdcbfbc792e0a671af914580a3b6e61e8367a632f47767773784f0f6d2d7d043b6284f35c70561ebe73fd949d5fc6e4e9c55495fba870493c9a18a88f0026e5f36f3f9ecf3fe4bbb8f3e9ddd4e3182e739a945313229cf80261c5e51dd3a8f9ce6c7ee4d198e894258e51604b4df5e956744f0fcdcfede783c71bd819b368c3310c8670e68bd719485e71013ea0e8a6f39875fbf95c3eab8c4bbc927c2106c647255e2e5e71098fb784f9da6bcdd47b35a2ba95bba47c2c21791a442de8a140a18744c18edff91fa9e3db9a9692eaac004d424105ed65b37aae7a70d3b35b8334006d4000e8c021248663b94d9dfb2369fbf23eb397bf3fb397376e3a8fb9df9bc36d930b982585f33f0228f372e1e397f2fdea67f9ba6e71c82389c67394928f1d27479df7585dd3fc44a1f6c62abf6bdd1d9e63c800c82b82e90b50776f523d37fc2ab4354883807ae03d9c55630ee01013c46921111c726289ed10d029042dc0ee67f6f2d2dc17b9635b07eb554ad72405727201f35ff92cb70065713b7733b34e2024d5aa1eb811ff25a2f1dbf20f2bca8f6f4b76e104c5d5f7c3dd6fc0e40bd08c3e05f42868c621a10fa755243d8827d39214602b852520ecd1683f1ae5c36bdfe47b1f74f08bd403dd92fc4bcfe6ba697e2e000a4f56f75cc03137a5be95101940eb0d1496f9f88e4772776abbb015ea48dc133cfa8535dd2cb82b71627fe86dd27f3cd4d5779402e21696df4de4608803dfdfca836d11de4af5ace4bba87c643ed703a5621407689c0efa09e9b909c403cef681ebc99b90c77fba044b530fb614f6fe5e5a17bfee59d75531abfd24d74bfa4086eda0ea359c94b8973fe2c0abcdacb0ed810001af46de45657c0a98a29cf0d26c097c18342440e3f550fc8cb3a3fd465c530ab9c125b83ff54025a4aaefe4e0dc17f84553c4b3bdd45fd03782f55240ac3bcedfdb63fcb67faf80420f155f9ac66c72b4db9200d5cf393f1e9c8328f430df2d5973ec511a91c973f58b5fe0b95e83bf9f555eb2c3eff78747ba72af7c446720ca2bfd3b14b804de4f4fe47cc04f0ea65d1ff386dd7201555e8d678fd92f04d6d4b976f8a6e7a2ca11d6fb6a6a6a9add6ef7888713be759858b74e8352031a9726707fa280b3812272508ef43ff8835fa2a0c8cd1382c4a02f8180eeea0e7ee99988f015291ccda9bba6a62636d273987812352bf512b31447fa2b2c90856efc3832243709d9f4cfb826e673b3142c4e2dec3388def5176da3955fa14bd11f9663e7e7e78fb8a12f39f0f3695808e2294502671e2e37d995333228c8b995f08fe54c724b7e985a60d8988fede4ede79bb46d3e8fcb48040e9b30bc64c6e122cf8526a134f9db56d8e178ff1a8a39450680acef4274c570f519fc9f61130147c5792fc0be6f6f6153698167afdbed8e4b29873ce5693a90a7512a0525c9df96c26a8dd08333d6c939038a8c5970de6f38e4ff194bde3ec29a884947678c8eeb37f112d0545c5cbc4fd3b4e440ef8cbe910dd7915fe0667eff0ee1b4dcad1d1ce1582b40ce2019c06c037d97ff8187be3283f74b3cd41c8e500fecaeaeaeeef8b84510471a93f229714bae4edd173589bdd8c4411cdb58b2ebca1952925a8a8d935c19f8e96e5e07b624eef2e8f9e79f7f467ddbea1e10ff0bcf2f427a24b334415db2ccb4b0f7f570b83dc61101bd2a073d89a96aa3c279e3ba8170e22ecdcaca4aef89a78d0c9abee89001f0d9c94cf46afc777fa180b049f48583ec0082ca592839e756ac3e991e6fe338920084659d997b5ebf18aa9e75b68fde88cfe7e26a2958942c570a5ac31c7db89ead3899b97de4a250cf7405001efb147ce133cef6772f42f83dccf7481e4c3da6374ef8a77b780f382c1c07987ec2857200191fe96ebe0a2efb0a886b9cdfff53cb451ec9e3405ef2184b616fefa471f587bc0bb42867c6ba9cebae20c3841cb81ece790ef883f33b7233177a246b85e0bcd4e39afb68bff3cfbc0e1cc27180252775c939648c90e012284de487beb808f9d9a9d47a258f4b416dea711d317a57ed60d3ce2e3e948203b6a2931c5e012e2384bc77f500192d5fc65deea3ce2bf989382eecb4374ee4378dfcf5f106de96827db6a2951c951d496484907f7ad9f90e2ec15be0e6f36ec9d3380ea77ef4c689ac6f62cb9d7fe26501fb6c45234e5044ce6956a9c8a896a5e02c4df018c79111b731df6c65e757dee645609f721249735690a722a3843cbd9b8e8321965bea5899a09c94858826e800f625be739e0cc82021f7d6c2b7fe4aecfa4dbcb4a79b27535526af86fbdfab98f7bbcb9907484b41d919b31764161923e47b5ba1cc8bdad24ed757dfe1a1963e7e9f5aae09bc574d65c9cfeaf857a0b44b47cb73e59effe37864b4cbead2513e17e6bb015a96fd8de55d3a5b53cbdd92c2ebce61d9f7e7b008288e9ae3848c3862a6e31afef57ef63e5ccfd2b0c947a9e5f92e26fc470df7947999468ec662a522e38424a080d80fb6b1f5b9fd2cd52d82c9c71e36d11b82f49678f82403b158394b4ada08494e4283f37087e3c9b381de5bde61d3a666be6b9a447b747a9fdfcf9f3eb3815f3586083010a6aa12ff99aeea8f1aa46d60a8699a3671e2c4e22baeb8a2fcf6db6f374a4b4b6ddb1eda184e0ac1ae964ef9c10b4fbc531cfae3d3cda1f8d45bf7f9dfa9ad2d6a9f397346f7e73ef739dfecd9b32bdd6eb77df0e0c1981022428ed9b4d24288104254545414af5fbffebaaaaaaa3abfdf1f95520eeb414d9c34894fd7fe58b6f7463cdece4eb14dc517959496868a8b8bfbdc6eb795b23cf66660238e5d2b67c628696b2145454545f3e6cd5b98b6eb1516503da9f2a4658661d8dddddd79c0361c67558c1c6929a345a80f099665c50f1f3e5c8a331d949b1c2103864948228c3463537f0b215c96657971727f732a606e585d56281452baae1f8c46a3d5baaebb1273659d11082144341a8d0583c120391e753268ac5ebd5a5fbd7af5ddc00ca00a279bf64cc2064252ca1edbb6738a94614d1c80f34022c07ee00867befb528069db762f39e6b01aae9625185884385373f62413496db24f86a88f1ba39d9290840017524af737bff9cd0be6cd9be79b3367ceb9050505166476b42c84c8bad1ba10826834aa0b216a841027f42ca724c4344d9452bacbe572af58b1e21edbb693339266db5b396a5058580810370c43eaba6e92129f7c4a429a9b9bed8e8e8e8d6d6d6de78442a1024065cb7a50a31cc2e5727976eedcd9c4406ac5a05673d670a698a9022ac8d2c1e42886e976bb038661b400d1c11022189828c633a2551b9b48ae241407aca1ca81f1d6917e1c33edc8ff0311504d2a89d602380000000049454e44ae426082 + + + + + + +
+ + + + ShapeItem1 + + + + + ReportHeader1 + + + + + + + + + + + + + + + + + ShapeItem2 + + + + + ReportHeader1 + + + + + + + + + + + + + + + + + TextItem9 + + + + + ReportHeader1 + + + + + + + REPORT + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem10 + + + + + ReportHeader1 + + + + + + + HEADER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + + + + + DataBand1 + + + + TextItem3 + + + + + DataBand1 + + + + + + + $D{orders.OrderDate} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem4 + + + + + DataBand1 + + + + + + + $D{orders.OrderID} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem12 + + + + + DataBand1 + + + + + + + DATA BAND + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem16 + + + + + DataBand1 + + + + + + + OrderID + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem17 + + + + + DataBand1 + + + + + + + Order Date + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + + + + + orders + + + + + + + + + + + + + GroupBandHeader1 + + + + TextItem2 + + + + + GroupBandHeader1 + + + + + + + $D{orders.CompanyName} + + + + + + + + + + + + + + + + + + + + + + + + + + + ShapeItem3 + + + + + GroupBandHeader1 + + + + + + + + + + + + + + + + + TextItem11 + + + + + GroupBandHeader1 + + + + + + + GROUP HEADER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + CompanyName + + + + + + + + + SubDetailBand1 + + + + TextItem5 + + + + + SubDetailBand1 + + + + + + + $D{orderitems.ProductName} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem6 + + + + + SubDetailBand1 + + + + + + + $D{orderitems.Quantity} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem7 + + + + + SubDetailBand1 + + + + + + + $S{line("SubDetailBand1")} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem13 + + + + + SubDetailBand1 + + + + + + + SUBDETAIL BAND + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + DataBand1 + + + + orderitems + + + + + + + + + SubDetailFooterBand1 + + + + TextItem8 + + + + + SubDetailFooterBand1 + + + + + + + $S{SUM($D{orderitems.Quantity},"SubDetailBand1")} + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem14 + + + + + SubDetailFooterBand1 + + + + + + + SUBDETAIL FOOTER + + + + + + + + + + + + + + + + + + + + + + + + + + + TextItem15 + + + + + SubDetailFooterBand1 + + + + + + + Total + + + + + + + + + + + + + + + + + + + + + + + + + + + ShapeItem4 + + + + + SubDetailFooterBand1 + + + + + + + + + + + + + + + + + + + ReportPage1 + + + + + + + SubDetailBand1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + northwind + QSQLITE + ./demo_reports/northwind.db + + + + + + + + + + + orders + Select * from orders +inner join customers on customers.customerid = orders.customerid order by companyname +limit 50 + northwind + + + + + + orderitems + Select * from orderitems + inner join products on products.productid = orderitems.productid +where orderid = $D{orders.orderid} + northwind + orders + + + + + + + + + ReportPage1_DataBand1.bandRegistred.connect(SB1AfterData); +ReportPage1_SubDetailBand1.bandRegistred.connect(SB2AfterData); + +function SB1AfterData(){ + addTableOfContensItem(getField("orders.OrderID"),getField("orders.OrderID"), getVariable("#PAGE")); +} + +function SB2AfterData(){ + addTableOfContensItem(getField("orders.OrderID")+getField("orderItems.ProductName"), getField("orderItems.ProductName"), getVariable("#PAGE"), 5); +} + + + +
+