Add text formatting to the TaskDelegate

Reviewed-By: hunger
This commit is contained in:
dt
2010-04-09 18:46:34 +02:00
parent 5b2f892190
commit 2d908b558a
4 changed files with 33 additions and 4 deletions

View File

@@ -36,7 +36,7 @@
using namespace ProjectExplorer;
LinuxIccParser::LinuxIccParser()
: m_expectFirstLine(true)
: m_expectFirstLine(true), m_indent(0)
{
// main.cpp(53): error #308: function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible
@@ -78,12 +78,26 @@ void LinuxIccParser::stdError(const QString &line)
m_expectFirstLine = false;
} else if (!m_expectFirstLine && m_caretLine.indexIn(line) != -1) {
// TODO do something
// Format the last line as code
QTextLayout::FormatRange fr;
fr.start = m_temporary.description.lastIndexOf('\n') + 1;
fr.length = m_temporary.description.length() - fr.start;
fr.format.setFontItalic(true);
m_temporary.formats.append(fr);
QTextLayout::FormatRange fr2;
fr2.start = fr.start + line.indexOf('^') - m_indent;
fr2.length = 1;
fr2.format.setFontWeight(QFont::Bold);
m_temporary.formats.append(fr2);
} else if (!m_expectFirstLine && line.trimmed().isEmpty()) { // last Line
m_expectFirstLine = true;
emit addTask(m_temporary);
} else if (!m_expectFirstLine && m_continuationLines.indexIn(line) != -1) {
m_temporary.description.append("\n");
m_indent = 0;
while (m_indent < line.length() && line.at(m_indent).isSpace())
m_indent++;
m_temporary.description.append(m_continuationLines.cap(1).trimmed());
} else {
IOutputParser::stdError(line);