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: