0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +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,12 +155,13 @@ QObject *ReportEnginePrivate::elementAt(const QString &, int index)
return pageAt(index);
}
PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName)
PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName, bool preview)
{
PageDesignIntf* page =new PageDesignIntf();
page->setObjectName(pageName);
page->pageItem()->setObjectName("Report"+pageName);
page->setReportEditor(this);
if (!preview)
page->setReportEditor(this);
page->setReportSettings(&m_reportSettings);
return page;
}
@ -185,7 +186,7 @@ bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
PageDesignIntf *ReportEnginePrivate::createPreviewPage()
{
return createPage();
return createPage("preview",true);
}
int ReportEnginePrivate::elementsCount(const QString &)

View File

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

View File

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

View File

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