59 QWidget::closeEvent(event);
62 if (
ui->TEText->toPlainText().toStdString() != Text)
64 auto Reply = QMessageBox::question(
this,
"DynExp - Save changes?",
65 QString::fromStdString(
"The file \"" +
Filename.string() +
"\" has been edited. Save the changes?"),
66 QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No | QMessageBox::StandardButton::Abort,
67 QMessageBox::StandardButton::Abort);
69 if (Reply == QMessageBox::StandardButton::Abort)
75 else if (Reply == QMessageBox::StandardButton::Yes)
86 QWidget::closeEvent(event);
Implements a dialog to edit and save small pieces of text or (Python) code.
TextEditor(QWidget *parent, const std::filesystem::path &Filename)
QSyntaxHighlighter * SyntaxHighlighter
virtual void showEvent(QShowEvent *event) override
std::unique_ptr< Ui::TextEditor > ui
const std::filesystem::path Filename
bool DoSave()
Saves the editor's content to the file Filename.
virtual void closeEvent(QCloseEvent *event) override