diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -218,7 +218,9 @@ m_lateral.get("3d")->drawModel(fileName.toString()); const int tabs = m_instances->count(); - m_openFiles.append(fileName); + if(!m_openFiles.contains(fileName)) { + m_openFiles.append(fileName); + } for(int i=0; i < tabs; ++i){ auto instance = qobject_cast(m_instances->widget(i)); @@ -236,4 +238,4 @@ { return palette().text().color().value() >= QColor(Qt::lightGray).value() ? \ QString("dark") : QString("light"); -} \ No newline at end of file +} diff --git a/src/widgets/gcodeeditorwidget.cpp b/src/widgets/gcodeeditorwidget.cpp --- a/src/widgets/gcodeeditorwidget.cpp +++ b/src/widgets/gcodeeditorwidget.cpp @@ -43,6 +43,15 @@ } void GCodeEditorWidget::loadFile(const QUrl &file) { + //if the file is loaded then reload the document. + for (int i = 0 ; i < m_editor->documents().count(); i++) + { + if (m_editor->documents().at(i)->url() == file) { + m_editor->documents().at(i)->documentReload(); + return; + } + } + auto doc = m_editor->documents().first(); if(!doc->isEmpty()){ doc = newDoc();