+ if(word.width >= width()) {
+ 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()) {
+ w += word.trailing;
+ if(++wordidx < wrapList.count()) word = wrapList.at(wordidx);
+ else {
+ // 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();
+ break;
+ }
+ }
+ }
+ int lastcol = wordidx < wrapList.count() ? word.start : _layout->text().length();
+ line.setNumColumns(lastcol - line.textStart());// qDebug() << "setting cols:" << lastcol - line.textStart();
+ }
+
+ h += fontMetrics()->leading();