0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 09:04:39 +03:00

Script editor has been changed for preview mode

This commit is contained in:
Arin Alexander 2019-03-02 01:08:20 +03:00
parent 424665d038
commit ed902b4ef1
4 changed files with 10 additions and 7 deletions

View File

@ -155,11 +155,12 @@ QObject *ReportEnginePrivate::elementAt(const QString &, int index)
return pageAt(index); return pageAt(index);
} }
PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName) PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName, bool preview)
{ {
PageDesignIntf* page =new PageDesignIntf(); PageDesignIntf* page =new PageDesignIntf();
page->setObjectName(pageName); page->setObjectName(pageName);
page->pageItem()->setObjectName("Report"+pageName); page->pageItem()->setObjectName("Report"+pageName);
if (!preview)
page->setReportEditor(this); page->setReportEditor(this);
page->setReportSettings(&m_reportSettings); page->setReportSettings(&m_reportSettings);
return page; return page;
@ -185,7 +186,7 @@ bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
PageDesignIntf *ReportEnginePrivate::createPreviewPage() PageDesignIntf *ReportEnginePrivate::createPreviewPage()
{ {
return createPage(); return createPage("preview",true);
} }
int ReportEnginePrivate::elementsCount(const QString &) int ReportEnginePrivate::elementsCount(const QString &)

View File

@ -240,7 +240,7 @@ public slots:
bool slotLoadFromFile(const QString& fileName); bool slotLoadFromFile(const QString& fileName);
void cancelRender(); void cancelRender();
protected: protected:
PageDesignIntf* createPage(const QString& pageName=""); PageDesignIntf* createPage(const QString& pageName="", bool preview = false);
protected slots: protected slots:
void slotDataSourceCollectionLoaded(const QString& collectionName); void slotDataSourceCollectionLoaded(const QString& collectionName);
private slots: private slots:

View File

@ -336,7 +336,7 @@ QStringList ScriptEngineManager::functionsNames()
} }
void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
if (m_dataManager != dataManager){ if (dataManager && m_dataManager != dataManager){
m_dataManager = dataManager; m_dataManager = dataManager;
if (m_dataManager){ if (m_dataManager){
foreach(QString func, m_dataManager->groupFunctionNames()){ foreach(QString func, m_dataManager->groupFunctionNames()){

View File

@ -54,14 +54,16 @@ void ScriptEditor::setReportEngine(ReportEnginePrivateInterface* reportEngine)
{ {
m_reportEngine = reportEngine; m_reportEngine = reportEngine;
DataSourceManager* dm = m_reportEngine->dataManager(); DataSourceManager* dm = m_reportEngine->dataManager();
initEditor(dm); if (dm) initEditor(dm);
else ui->tabWidget->setVisible(false);
} }
void ScriptEditor::setReportPage(PageDesignIntf* page) void ScriptEditor::setReportPage(PageDesignIntf* page)
{ {
m_page = page; m_page = page;
DataSourceManager* dm = page->datasourceManager(); DataSourceManager* dm = page->datasourceManager();
initEditor(dm); if (dm) initEditor(dm);
else ui->tabWidget->setVisible(false);
} }
void ScriptEditor::setPageBand(BandDesignIntf* band) void ScriptEditor::setPageBand(BandDesignIntf* band)