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

Save and restore of Designer widget have been fixed

This commit is contained in:
Arin Alexander 2019-02-12 22:28:16 +03:00
parent b839694e59
commit edbba49114
3 changed files with 21 additions and 12 deletions

View File

@ -178,16 +178,16 @@ void ReportDesignWidget::setUseMagnet(bool useMagnet)
} }
} }
void ReportDesignWidget::saveState(QSettings* settings) void ReportDesignWidget::saveState()
{ {
settings->beginGroup("DesignerWidget"); m_settings->beginGroup("DesignerWidget");
settings->setValue("hGridStep",m_horizontalGridStep); m_settings->setValue("hGridStep",m_horizontalGridStep);
settings->setValue("vGridStep",m_verticalGridStep); m_settings->setValue("vGridStep",m_verticalGridStep);
settings->setValue("defaultFont",m_defaultFont); m_settings->setValue("defaultFont",m_defaultFont);
settings->setValue("useGrid",m_useGrid); m_settings->setValue("useGrid",m_useGrid);
settings->setValue("useDarkTheme",m_useDarkTheme); m_settings->setValue("useDarkTheme",m_useDarkTheme);
settings->setValue("ScriptEditorState", m_scriptEditor->saveState()); m_settings->setValue("ScriptEditorState", m_scriptEditor->saveState());
settings->endGroup(); m_settings->endGroup();
} }
void ReportDesignWidget::applySettings() void ReportDesignWidget::applySettings()
@ -284,6 +284,14 @@ void ReportDesignWidget::createTabs(){
} }
m_scriptEditor = new ScriptEditor(this); m_scriptEditor = new ScriptEditor(this);
// m_settings->beginGroup("DesignerWidget");
// QVariant v = m_settings->value("ScriptEditorState");
// if (v.isValid()){
// m_scriptEditor->restoreState(v.toByteArray());
// }
// m_settings->endGroup();
connect(m_scriptEditor, SIGNAL(textChanged()), this, SLOT(slotScriptTextChanged())); connect(m_scriptEditor, SIGNAL(textChanged()), this, SLOT(slotScriptTextChanged()));
m_scriptEditor->setReportEngine(m_report); m_scriptEditor->setReportEngine(m_report);
pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script")); pageIndex = m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));

View File

@ -112,7 +112,7 @@ public:
bool emitSaveReport(); bool emitSaveReport();
bool emitSaveReportAs(); bool emitSaveReportAs();
bool emitLoadReport(); bool emitLoadReport();
void saveState(QSettings *settings); void saveState();
void loadState(); void loadState();
void applySettings(); void applySettings();
void applyUseGrid(); void applyUseGrid();

View File

@ -650,6 +650,7 @@ void ReportDesignWindow::updateRedoUndo()
void ReportDesignWindow::startNewReport() void ReportDesignWindow::startNewReport()
{ {
m_reportDesignWidget->saveState();
m_reportDesignWidget->clear(); m_reportDesignWidget->clear();
m_reportDesignWidget->createStartPage(); m_reportDesignWidget->createStartPage();
m_lblReportName->setText(""); m_lblReportName->setText("");
@ -663,6 +664,7 @@ void ReportDesignWindow::startNewReport()
showDefaultToolBars(); showDefaultToolBars();
m_reportDesignWidget->report()->dataManager()->dropChanges(); m_reportDesignWidget->report()->dataManager()->dropChanges();
m_reportDesignWidget->report()->scriptContext()->dropChanges(); m_reportDesignWidget->report()->scriptContext()->dropChanges();
m_reportDesignWidget->loadState();
} }
@ -670,7 +672,6 @@ void ReportDesignWindow::writePosition()
{ {
settings()->beginGroup("DesignerWindow"); settings()->beginGroup("DesignerWindow");
settings()->setValue("Geometry",saveGeometry()); settings()->setValue("Geometry",saveGeometry());
// settings()->setValue("State",saveState());
settings()->endGroup(); settings()->endGroup();
} }
@ -706,7 +707,7 @@ void ReportDesignWindow::writeState()
++it; ++it;
} }
settings()->endGroup(); settings()->endGroup();
m_reportDesignWidget->saveState(settings()); m_reportDesignWidget->saveState();
} }
void ReportDesignWindow::createRecentFilesMenu() void ReportDesignWindow::createRecentFilesMenu()