diff --git a/agui2/src/Graphics/Dialogs/InputDialog.cpp b/agui2/src/Graphics/Dialogs/InputDialog.cpp index 8dc526fb8fb14870df83e920707e248ed1345f67..7aaa880b173d49f19be0345583ee805184b85310 100644 --- a/agui2/src/Graphics/Dialogs/InputDialog.cpp +++ b/agui2/src/Graphics/Dialogs/InputDialog.cpp @@ -28,7 +28,7 @@ std::shared_ptr<abstraction::OperationAbstraction> InputDialog::getAutomaton() { return this->automaton; } -void InputDialog::setAutomaton(std::shared_ptr<abstraction::OperationAbstraction> automaton) { +void InputDialog::setAutomaton(std::shared_ptr<abstraction::OperationAbstraction> automaton, bool updateText) { this->automaton = std::move(automaton); QSignalBlocker blockerXML(ui->plainTextEdit_xml); QSignalBlocker blockerText(ui->plainTextEdit_text); @@ -41,12 +41,13 @@ void InputDialog::setAutomaton(std::shared_ptr<abstraction::OperationAbstraction ui->plainTextEdit_xml->clear(); } - if (auto text = Converter::toString(this->automaton)) { - ui->plainTextEdit_text->setPlainText(*text); - } - else { - ui->plainTextEdit_text->clear(); - } + if ( updateText ) + if (auto text = Converter::toString(this->automaton)) { + ui->plainTextEdit_text->setPlainText(*text); + } + else { + ui->plainTextEdit_text->clear(); + } if (auto image = Converter::toPNG(this->automaton)) { ui->label_image->setPixmap(QPixmap::fromImage(*image)); @@ -89,7 +90,7 @@ void InputDialog::on_plainTextEdit_xml_textChanged() { void InputDialog::on_plainTextEdit_text_textChanged() { if (auto automaton = Converter::tryParse(ui->plainTextEdit_text->toPlainText())) { - this->setAutomaton(std::move(automaton)); + this->setAutomaton(std::move(automaton), false); } } diff --git a/agui2/src/Graphics/Dialogs/InputDialog.hpp b/agui2/src/Graphics/Dialogs/InputDialog.hpp index 0436ca9edae2a68c2717a91cea6084ab6a1cc702..8f5596f67b2b568e1b159de24995e0461e61d5bd 100644 --- a/agui2/src/Graphics/Dialogs/InputDialog.hpp +++ b/agui2/src/Graphics/Dialogs/InputDialog.hpp @@ -24,7 +24,7 @@ private slots: void on_openFileButton_clicked(); private: - void setAutomaton(std::shared_ptr<abstraction::OperationAbstraction> automaton); + void setAutomaton(std::shared_ptr<abstraction::OperationAbstraction> automaton, bool updateText = true ); void setTabShown(QWidget* tab, bool value);