ProjectExplorer: Use monospace font in task tool tips for compile issues

Otherwise, error message alignment can get messed up, as the default
tool tip font is typically not proportional.

Fixes: QTCREATORBUG-18264
Change-Id: I7c827d859720c4d3a89726000f00930219c68351
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-07-18 16:11:41 +02:00
parent 59e2774d0d
commit 98346aaab1

View File

@@ -71,7 +71,13 @@ public:
: QApplication::translate("TaskHub", "Warning"));
setPriority(task.type == Task::Error ? TextEditor::TextMark::NormalPriority
: TextEditor::TextMark::LowPriority);
if (task.category == Constants::TASK_CATEGORY_COMPILE) {
setToolTip("<html><body><b>" + QApplication::translate("TaskHub", "Build Issue")
+ "</b><br/><code style=\"white-space:pre;font-family:monospace\">"
+ task.description.toHtmlEscaped() + "</code></body></html>");
} else {
setToolTip(task.description);
}
setIcon(task.icon);
setVisible(!task.icon.isNull());
}
@@ -154,7 +160,7 @@ void TaskHub::addTask(Task task)
task.line = -1;
task.movedLine = task.line;
if ((task.options & Task::AddTextMark) && task.line != -1)
if ((task.options & Task::AddTextMark) && task.line != -1 && task.type != Task::Unknown)
task.setMark(new TaskMark(task));
emit m_instance->taskAdded(task);
}