From b8af0b4fe92cd17d69c41df613dd660d48d5fca6 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 19 Jun 2008 12:35:33 +0200 Subject: [PATCH] More wordwrap fixes. --- src/qtui/chatitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index ff81259c..c9724e27 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -76,8 +76,9 @@ int ChatItem::heightForWidth(int width) { // and also apply formats in this step...) // Just using width should be a good estimate, but since a character can't be split in the middle, we // subtract averageCharWidth as well... sometimes this won't be enough, but meh. - w -= width - 4*fontMetrics()->averageCharWidth(); + w -= width - fontMetrics()->averageCharWidth(); } + w += wrapList.at(i).trailing; } return _lines * fontMetrics()->lineSpacing(); } @@ -126,7 +127,6 @@ void ChatItem::updateLayout() { line.setLineWidth(width()); word.width -= line.naturalTextWidth(); word.start = line.textStart() + line.textLength(); - //qDebug() << "setting width: " << width(); } else { int w = 0; while((w += word.width) <= width() && wordidx < wrapList.count()) { @@ -136,7 +136,7 @@ void ChatItem::updateLayout() { // last word (and it fits), but if we expected an extra line, wrap anyway here // yeah, this is cheating, but much cheaper than computing widths ourself if(_layout->lineCount() < _lines) { - wordidx--; qDebug() << "trigger!" << _lines << _layout->text(); + wordidx--; break; } } -- 2.20.1