From 0f4bf6ecf5520739c428c5583c5a0c25ffb79685 Mon Sep 17 00:00:00 2001 From: liuminghang Date: Mon, 6 Sep 2021 13:27:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbug85684?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: plaintEdit太过于灵敏,换用qtextedit Log: 与编辑栏有关 Bug: https://pms.uniontech.com/zentao/bug-view-85684.html Change-Id: I1b85e533e9e4a02447c4da7de299323fa576f54b --- src/mainwidget.cpp | 8 +++++--- src/resulttextview.cpp | 2 +- src/resulttextview.h | 5 ++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 1f7dbac..7a14946 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -402,7 +402,8 @@ void MainWidget::loadHtml(const QString &html) if (!html.isEmpty()) { m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_resultWidget->setCurrentWidget(m_plainTextEdit); - m_plainTextEdit->appendHtml(html); +// m_plainTextEdit->appendHtml(html); + m_plainTextEdit->setHtml(html); } else { resultEmpty(); } @@ -413,7 +414,8 @@ void MainWidget::loadString(const QString &string) if (!string.isEmpty()) { m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_resultWidget->setCurrentWidget(m_plainTextEdit); - m_plainTextEdit->appendPlainText(string); +// m_plainTextEdit->appendPlainText(string); + m_plainTextEdit->setText(string); //读取完了显示在最上方 m_plainTextEdit->moveCursor(QTextCursor::Start) ; m_plainTextEdit->ensureCursorVisible() ; @@ -498,7 +500,7 @@ void MainWidget::slotCopy() m_plainTextEdit->copy(); } else { QTextDocument *document = m_plainTextEdit->document(); - DPlainTextEdit *tempTextEdit = new DPlainTextEdit(this); + QTextEdit *tempTextEdit = new QTextEdit(this); tempTextEdit->setDocument(document); tempTextEdit->selectAll(); tempTextEdit->copy(); diff --git a/src/resulttextview.cpp b/src/resulttextview.cpp index d0f8595..953c9a3 100644 --- a/src/resulttextview.cpp +++ b/src/resulttextview.cpp @@ -67,5 +67,5 @@ void ResultTextView::resizeEvent(QResizeEvent *event) { emit sigChangeSize(); this->viewport()->setFixedWidth(this->width() - 15); - DPlainTextEdit::resizeEvent(event); + QTextEdit::resizeEvent(event); } diff --git a/src/resulttextview.h b/src/resulttextview.h index 073ac70..5a47fdd 100644 --- a/src/resulttextview.h +++ b/src/resulttextview.h @@ -2,13 +2,12 @@ #define RESULTTEXTVIEW_H #include -#include +#include #include #include -DWIDGET_USE_NAMESPACE -class ResultTextView : public DPlainTextEdit +class ResultTextView : public QTextEdit { Q_OBJECT public: