diff options
author | saturneric <[email protected]> | 2024-11-26 16:23:46 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-26 16:23:46 +0000 |
commit | f19beee8e28621bb045e45d71c963fbba1307f4b (patch) | |
tree | 20a8f52df99724f10bb20aa5273fe506f08e614e /src/ui/widgets/PlainTextEditorPage.cpp | |
parent | fix: change "Advance" to "Advanced" (diff) | |
download | GpgFrontend-f19beee8e28621bb045e45d71c963fbba1307f4b.tar.gz GpgFrontend-f19beee8e28621bb045e45d71c963fbba1307f4b.zip |
refactor: optimum code and reduce duplicate
Diffstat (limited to 'src/ui/widgets/PlainTextEditorPage.cpp')
-rw-r--r-- | src/ui/widgets/PlainTextEditorPage.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp index c1c679a6..ac41c9ab 100644 --- a/src/ui/widgets/PlainTextEditorPage.cpp +++ b/src/ui/widgets/PlainTextEditorPage.cpp @@ -81,7 +81,13 @@ const QString &PlainTextEditorPage::GetFilePath() const { return full_file_path_; } -QPlainTextEdit *PlainTextEditorPage::GetTextPage() { return ui_->textPage; } +auto PlainTextEditorPage::GetTextPage() -> QPlainTextEdit * { + return ui_->textPage; +} + +auto PlainTextEditorPage::GetPlainText() -> QString { + return ui_->textPage->toPlainText(); +} void PlainTextEditorPage::NotifyFileSaved() { this->is_crlf_ = false; @@ -212,7 +218,7 @@ void PlainTextEditorPage::slot_insert_text(QByteArray bytes_data) { read_bytes_ += bytes_data.size(); // insert the text to the text page - this->GetTextPage()->insertPlainText(bytes_data); + this->ui_->textPage->insertPlainText(bytes_data); this->ui_->characterLabel->setText( tr("%1 character(s)").arg(this->GetTextPage()->toPlainText().size())); |