Port the compile output window away from HTML to QTextCharFormat

Is more then twice as fast
This commit is contained in:
dt
2010-06-08 15:04:42 +02:00
parent d807b14c85
commit 181cecbb32
14 changed files with 98 additions and 55 deletions

View File

@@ -52,6 +52,8 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/)
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
agg->add(m_textEdit);
agg->add(new Find::BaseTextFind(m_textEdit));
qRegisterMetaType<QTextCharFormat>("QTextCharFormat");
}
bool CompileOutputWindow::hasFocus()
@@ -74,9 +76,16 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *)
return m_textEdit;
}
void CompileOutputWindow::appendText(const QString &text)
void CompileOutputWindow::appendText(const QString &text, const QTextCharFormat &textCharFormat)
{
m_textEdit->appendHtml(text);
QString textWithNewline = text;
if (!textWithNewline.endsWith("\n"))
textWithNewline.append("\n");
QTextCursor cursor = QTextCursor(m_textEdit->document());
cursor.movePosition(QTextCursor::End);
cursor.beginEditBlock();
cursor.insertText(textWithNewline, textCharFormat);
cursor.endEditBlock();
}
void CompileOutputWindow::clearContents()