From 5b2f892190a25f1d25e52d99ecdc5215766de545 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Fri, 9 Apr 2010 15:37:24 +0200
Subject: [PATCH] Multiline layout for TaskDelegate

Reviewed-By: hunger
---
 src/plugins/projectexplorer/taskwindow.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index a569fd5f21c..5b7d700e627 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -786,6 +786,7 @@ QSize TaskDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelInd
         // Layout the description
         int leading = fontLeading;
         int height = 0;
+        description.replace('\n', QChar::LineSeparator);
         QTextLayout tl(description);
         tl.beginLayout();
         while (true) {
@@ -858,7 +859,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
     int width = opt.rect.width() - model->sizeOfFile() - model->sizeOfLineNumber() - 12 - 22;
     if (!selected) {
         // in small mode we lay out differently
-        QString bottom = index.data(TaskModel::Description).toString();
+        QString bottom = index.data(TaskModel::Description).toString().split('\n').first();
         painter->drawText(22, 2 + opt.rect.top() + fm.ascent(), bottom);
         if (fm.width(bottom) > width) {
             // draw a gradient to mask the text
@@ -876,6 +877,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
         // Layout the description
         int leading = fm.leading();
         int height = 0;
+        description.replace('\n', QChar::LineSeparator);
         QTextLayout tl(description);
         tl.beginLayout();
         while (true) {
-- 
GitLab