0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

TableBuilder has been fixed

This commit is contained in:
Arin Alexander 2020-02-16 16:47:26 +03:00
parent 3653ebb859
commit cdab55a5fd
5 changed files with 16 additions and 14 deletions

View File

@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 35 LIMEREPORT_VERSION_RELEASE = 36
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -1137,7 +1137,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
restoreLinks(); restoreLinks();
snapshotItemsLayout(); snapshotItemsLayout();
BandDesignIntf* patternBand = dynamic_cast<BandDesignIntf*>(patternItem()); BandDesignIntf* patternBand = dynamic_cast<BandDesignIntf*>(patternItem());
if (patternBand && pass == FirstPass) emit(patternBand->preparedForRender());
arrangeSubItems(pass, dataManager); arrangeSubItems(pass, dataManager);
if (autoHeight()){ if (autoHeight()){
if (!keepTopSpace()) { if (!keepTopSpace()) {

View File

@ -1264,6 +1264,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand)
replaceGroupsFunction(bandClone); replaceGroupsFunction(bandClone);
} }
patternBand->preparedForRender();
bandClone->updateItemSize(m_datasources); bandClone->updateItemSize(m_datasources);
//m_scriptEngineContext->baseDesignIntfToScript(bandClone); //m_scriptEngineContext->baseDesignIntfToScript(bandClone);

View File

@ -587,8 +587,7 @@ void ScriptEngineManager::clearTableOfContents(){
} }
ScriptValueType ScriptEngineManager::moveQObjectToScript(QObject* object, const QString objectName) ScriptValueType ScriptEngineManager::moveQObjectToScript(QObject* object, const QString objectName)
{ {
ScriptValueType obj = scriptEngine()->globalObject().property(objectName); ScriptValueType obj = scriptEngine()->globalObject().property(objectName);
if (!obj.isNull()) delete obj.toQObject(); if (!obj.isNull()) delete obj.toQObject();
ScriptValueType result = scriptEngine()->newQObject(object); ScriptValueType result = scriptEngine()->newQObject(object);
@ -1934,7 +1933,7 @@ bool DatasourceFunctions::invalidate(const QString& datasourceName)
return false; return false;
} }
QObject* DatasourceFunctions::createTableBuilder(BaseDesignIntf* horizontalLayout) QObject* DatasourceFunctions::createTableBuilder(QObject* horizontalLayout)
{ {
return new TableBuilder(dynamic_cast<LimeReport::HorizontalLayout*>(horizontalLayout), dynamic_cast<DataSourceManager*>(m_dataManager)); return new TableBuilder(dynamic_cast<LimeReport::HorizontalLayout*>(horizontalLayout), dynamic_cast<DataSourceManager*>(m_dataManager));
} }
@ -1987,14 +1986,16 @@ void TableBuilder::buildTable(const QString& datasourceName)
{ {
checkBaseLayout(); checkBaseLayout();
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE); m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE);
m_dataManager->dataSource(datasourceName)->first(); IDataSource* ds = m_dataManager->dataSource(datasourceName);
bool firstTime = true; if (ds){
QObject* row = m_horizontalLayout; bool firstTime = true;
while(!m_dataManager->dataSource(datasourceName)->eof()){ QObject* row = m_horizontalLayout;
if (!firstTime) row = addRow(); while(!ds->eof()){
else firstTime = false; if (!firstTime) row = addRow();
fillInRowData(row); else firstTime = false;
m_dataManager->dataSource(datasourceName)->next(); fillInRowData(row);
ds->next();
}
} }
} }

View File

@ -338,7 +338,7 @@ public:
Q_INVOKABLE bool prior(const QString& datasourceName); Q_INVOKABLE bool prior(const QString& datasourceName);
Q_INVOKABLE bool isEOF(const QString& datasourceName); Q_INVOKABLE bool isEOF(const QString& datasourceName);
Q_INVOKABLE bool invalidate(const QString& datasourceName); Q_INVOKABLE bool invalidate(const QString& datasourceName);
Q_INVOKABLE QObject *createTableBuilder(BaseDesignIntf* horizontalLayout); Q_INVOKABLE QObject *createTableBuilder(QObject *horizontalLayout);
private: private:
IDataSourceManager* m_dataManager; IDataSourceManager* m_dataManager;
}; };