fix: 修复bug85684

Description: plaintEdit太过于灵敏,换用qtextedit

Log: 与编辑栏有关
Bug: https://pms.uniontech.com/zentao/bug-view-85684.html
Change-Id: I1b85e533e9e4a02447c4da7de299323fa576f54b
This commit is contained in:
liuminghang 2021-09-06 13:27:22 +08:00
parent a5ca0e54a4
commit 0f4bf6ecf5
3 changed files with 8 additions and 7 deletions

View File

@ -402,7 +402,8 @@ void MainWidget::loadHtml(const QString &html)
if (!html.isEmpty()) { if (!html.isEmpty()) {
m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_frameStackLayout->setContentsMargins(20, 0, 5, 0);
m_resultWidget->setCurrentWidget(m_plainTextEdit); m_resultWidget->setCurrentWidget(m_plainTextEdit);
m_plainTextEdit->appendHtml(html); // m_plainTextEdit->appendHtml(html);
m_plainTextEdit->setHtml(html);
} else { } else {
resultEmpty(); resultEmpty();
} }
@ -413,7 +414,8 @@ void MainWidget::loadString(const QString &string)
if (!string.isEmpty()) { if (!string.isEmpty()) {
m_frameStackLayout->setContentsMargins(20, 0, 5, 0); m_frameStackLayout->setContentsMargins(20, 0, 5, 0);
m_resultWidget->setCurrentWidget(m_plainTextEdit); m_resultWidget->setCurrentWidget(m_plainTextEdit);
m_plainTextEdit->appendPlainText(string); // m_plainTextEdit->appendPlainText(string);
m_plainTextEdit->setText(string);
//读取完了显示在最上方 //读取完了显示在最上方
m_plainTextEdit->moveCursor(QTextCursor::Start) ; m_plainTextEdit->moveCursor(QTextCursor::Start) ;
m_plainTextEdit->ensureCursorVisible() ; m_plainTextEdit->ensureCursorVisible() ;
@ -498,7 +500,7 @@ void MainWidget::slotCopy()
m_plainTextEdit->copy(); m_plainTextEdit->copy();
} else { } else {
QTextDocument *document = m_plainTextEdit->document(); QTextDocument *document = m_plainTextEdit->document();
DPlainTextEdit *tempTextEdit = new DPlainTextEdit(this); QTextEdit *tempTextEdit = new QTextEdit(this);
tempTextEdit->setDocument(document); tempTextEdit->setDocument(document);
tempTextEdit->selectAll(); tempTextEdit->selectAll();
tempTextEdit->copy(); tempTextEdit->copy();

View File

@ -67,5 +67,5 @@ void ResultTextView::resizeEvent(QResizeEvent *event)
{ {
emit sigChangeSize(); emit sigChangeSize();
this->viewport()->setFixedWidth(this->width() - 15); this->viewport()->setFixedWidth(this->width() - 15);
DPlainTextEdit::resizeEvent(event); QTextEdit::resizeEvent(event);
} }

View File

@ -2,13 +2,12 @@
#define RESULTTEXTVIEW_H #define RESULTTEXTVIEW_H
#include <QObject> #include <QObject>
#include <DPlainTextEdit> #include <QTextEdit>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
DWIDGET_USE_NAMESPACE
class ResultTextView : public DPlainTextEdit class ResultTextView : public QTextEdit
{ {
Q_OBJECT Q_OBJECT
public: public: