|
@@ -161,7 +161,9 @@ void MainWindow::onPageSwitdh(int state)
|
|
|
|
|
|
|
|
void MainWindow::onConfigureUpdate(const QString &filename)
|
|
void MainWindow::onConfigureUpdate(const QString &filename)
|
|
|
{
|
|
{
|
|
|
|
|
+ int canvasCount;
|
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
ProjectManager &projectMgr = AppContext::instance().projectManager();
|
|
|
|
|
+ canvasCount = projectMgr.canvasCount();
|
|
|
projectMgr.closeProject();
|
|
projectMgr.closeProject();
|
|
|
|
|
|
|
|
QString srcFileName = QString("%1/%2").arg(QDir::currentPath(), "update/monitor.xml");
|
|
QString srcFileName = QString("%1/%2").arg(QDir::currentPath(), "update/monitor.xml");
|
|
@@ -200,6 +202,22 @@ void MainWindow::onConfigureUpdate(const QString &filename)
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ LOG_INFO("begin release exist canvas");
|
|
|
|
|
+ {
|
|
|
|
|
+ QList<QWidget*> widgets;
|
|
|
|
|
+ for (int i = 0; i < m_pStackedWidget->count(); ++i) {
|
|
|
|
|
+ widgets << m_pStackedWidget->widget(i);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (QWidget *w : widgets) {
|
|
|
|
|
+ Canvas *pCanvas = static_cast<Canvas *>(w);
|
|
|
|
|
+ pCanvas->clear();
|
|
|
|
|
+ m_pStackedWidget->removeWidget(w);
|
|
|
|
|
+ delete w;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ LOG_INFO("release exist canvas complete, widget count: {}", m_pStackedWidget->count());
|
|
|
|
|
+
|
|
|
bool result = projectMgr.openProject(dstFileName);
|
|
bool result = projectMgr.openProject(dstFileName);
|
|
|
if(result)
|
|
if(result)
|
|
|
{
|
|
{
|
|
@@ -212,7 +230,7 @@ void MainWindow::onConfigureUpdate(const QString &filename)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
LOG_INFO("start reload monitor configure");
|
|
LOG_INFO("start reload monitor configure");
|
|
|
- int canvasCount = projectMgr.canvasCount();
|
|
|
|
|
|
|
+ canvasCount = projectMgr.canvasCount();
|
|
|
int index = -1;
|
|
int index = -1;
|
|
|
for(int i = 0; i < canvasCount; i++)
|
|
for(int i = 0; i < canvasCount; i++)
|
|
|
{
|
|
{
|