From ba33e4be9f783fb07404ffbe0b26780e6d8400b7 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 10 Oct 2012 13:09:41 +0200 Subject: [PATCH] EnvironmentMode; Enable text wrapping for tooltips This fixes the problem described in the bug report, but leaves the tooltip still in a ugly state as it breaks at almost random points. Without making assumptions about the content of environment variables, that's as good as the breaking can be. Task-number: QTCREATORBUG-7993 Change-Id: Id42c597640cf181aff5b8727dfdb9d21e226d907 Reviewed-by: Oliver Wolff Reviewed-by: Daniel Teske --- src/libs/utils/environmentmodel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp index 963994078ce..8992ad7e4b4 100644 --- a/src/libs/utils/environmentmodel.cpp +++ b/src/libs/utils/environmentmodel.cpp @@ -148,7 +148,14 @@ QVariant EnvironmentModel::data(const QModelIndex &index, int role) const if (pos >= 0) return d->m_items.at(pos).value; } - return d->m_resultEnvironment.value(d->m_resultEnvironment.constBegin() + index.row()); + QString value = d->m_resultEnvironment.value(d->m_resultEnvironment.constBegin() + index.row()); + if (role == Qt::ToolTipRole) { + // Use html to enable text wrapping + value = value.toHtmlEscaped(); + value.prepend(""); + value.append(""); + } + return value; } } if (role == Qt::FontRole) {