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

TOC generation has been fixed

This commit is contained in:
Arin Alexander 2020-02-03 21:50:28 +03:00
parent 2b5a79e79c
commit f73055e347
8 changed files with 40 additions and 21 deletions

View File

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

View File

@ -468,7 +468,7 @@ public:
QVariant getBookMark(const QString& key);
void copyBookmarks(BookmarkContainerDesignIntf* source);
private:
QMap<QString,QVariant> m_bookmarks;
QHash<QString,QVariant> m_bookmarks;
};
} //namespace LimeReport

View File

@ -719,24 +719,35 @@ QVariant CallbackDatasource::dataByKeyField(const QString& columnName, const QSt
{
int backupCurrentRow = m_currentRow;
QVariant result = QVariant();
first();
if (!checkIfEmpty()){
int currentRow = 0;
do {
QVariant key = callbackData(keyColumnName, currentRow);
m_currentRow = m_lastKeyRow;
if (next()){
for (int i = 0; i < 10; ++i){
QVariant key = callbackData(keyColumnName, m_currentRow);
if (key == keyData){
result = callbackData(columnName, currentRow);
break;
result = callbackData(columnName, m_currentRow);
m_lastKeyRow = m_currentRow;
m_currentRow = backupCurrentRow;
return result;
}
currentRow++;
} while (next());
if (!next()) break;
}
}
first();
if (backupCurrentRow != -1){
for (int i = 0; i < backupCurrentRow; ++i)
next();
if (!checkIfEmpty()){
do {
QVariant key = callbackData(keyColumnName, m_currentRow);
if (key == keyData){
result = callbackData(columnName, m_currentRow);
m_lastKeyRow = m_currentRow;
m_currentRow = backupCurrentRow;
return result;
}
} while (next());
}
m_currentRow = backupCurrentRow;
return result;
}

View File

@ -410,8 +410,8 @@ private:
class CallbackDatasource :public ICallbackDatasource, public IDataSource {
Q_OBJECT
public:
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1),
m_rowCount(-1), m_getDataFromCache(false){}
CallbackDatasource(): m_currentRow(-1), m_eof(false), m_columnCount(-1),
m_rowCount(-1), m_getDataFromCache(false), m_lastKeyRow(0){}
bool next();
bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;}
bool prior();
@ -431,6 +431,7 @@ public:
private:
bool checkNextRecord(int recordNum);
bool checkIfEmpty();
QVariant callbackData(const QString& columnName, int row);
private:
QVector<QString> m_headers;
int m_currentRow;
@ -439,7 +440,7 @@ private:
int m_rowCount;
QHash<QString, QVariant> m_valuesCache;
bool m_getDataFromCache;
QVariant callbackData(const QString& columnName, int row);
int m_lastKeyRow;
};
class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{

View File

@ -722,6 +722,7 @@ void ReportDesignWidget::initThemeIfExist(const QString &themeName, const QStrin
void ReportDesignWidget::previewReport()
{
if (report()->isBusy()) return;
prepareReport();
#ifdef HAVE_QTDESIGNER_INTEGRATION
updateDialogs();
@ -734,6 +735,7 @@ void ReportDesignWidget::previewReport()
void ReportDesignWidget::printReport()
{
if (report()->isBusy()) return;
prepareReport();
#ifdef HAVE_QTDESIGNER_INTEGRATION
updateDialogs();

View File

@ -1264,7 +1264,9 @@ void ReportDesignWindow::slotPrintReport()
void ReportDesignWindow::slotPreviewReport()
{
m_previewReportAction->setDisabled(true);
m_reportDesignWidget->previewReport();
m_previewReportAction->setDisabled(false);
}
void ReportDesignWindow::slotItemActionCliked()

View File

@ -113,6 +113,7 @@ public:
virtual void cancelRender() = 0;
virtual void setShowProgressDialog(bool value) = 0;
virtual bool isShowProgressDialog() const = 0;
virtual bool isBusy() = 0;
};
class PrintProcessor{

View File

@ -261,11 +261,11 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool
renderReportHeader(m_patternPageItem, AfterPageHeader);
BandDesignIntf* lastRenderedBand = 0;
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled;i++){
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled; i++){
lastRenderedBand = m_patternPageItem->dataBandAt(i);
initDatasource(lastRenderedBand->datasourceName());
renderDataBand(lastRenderedBand);
if (i<m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand);
if (i < m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand);
}
if (reportFooter)
@ -475,7 +475,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
if (bandData){
bandClone = bandData;
} else {
bandClone=renderData(patternBand);
bandClone = renderData(patternBand);
}
if (isLast) bandClone->setBootomSpace(1);
@ -543,8 +543,10 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
savePage();
startNewPage();
if (!bandIsSliced){
BandDesignIntf* t = renderData(patternBand);
t->copyBookmarks(bandClone);
delete bandClone;
bandClone = renderData(patternBand);
bandClone = t;
}
}
if (!registerBand(bandClone)) {