Qt: Add "success" hint to IO Console Dialog

This commit is contained in:
João Valverde 2023-08-16 15:30:46 +01:00
parent 5a1da4f692
commit 5d35745f01
2 changed files with 13 additions and 0 deletions

View File

@ -85,6 +85,14 @@ void IOConsoleDialog::clearHintText()
ui->hintLabel->clear();
}
void IOConsoleDialog::clearSuccessHint()
{
// Text changed so we no longer have a success.
ui->hintLabel->clear();
// Disconnect this slot until the next success.
disconnect(ui->inputPlainTextEdit, &QPlainTextEdit::textChanged, this, &IOConsoleDialog::clearSuccessHint);
}
void IOConsoleDialog::acceptInput()
{
clearHintText();
@ -113,6 +121,10 @@ void IOConsoleDialog::acceptInput()
g_free(error_str);
}
}
else {
setHintText("Code evaluated successfully.");
connect(ui->inputPlainTextEdit, &QPlainTextEdit::textChanged, this, &IOConsoleDialog::clearSuccessHint);
}
}
void IOConsoleDialog::appendOutputText(const QString &text)

View File

@ -40,6 +40,7 @@ public:
private slots:
void acceptInput();
void on_clearActivated(void);
void clearSuccessHint(void);
private:
Ui::IOConsoleDialog *ui;