In recent Qt 4.6 versions, there is a commit[1] that changes behavior wrt to lineSpacing() and
friends. Since (at least on my box) the font leading (the distance between text lines) seems to be
always -1 (for reasons as of yet unbeknownst to me), using lineSpacing() lets text lines in ChatView
overlap. This workarounds this with using at least height().
[1] http://qt.gitorious.org/qt/qt/commit/
04d18b38c38c5ff623b30366ea08d56128b9b7d0
WrapColumnFinder finder(this);
while(finder.nextWrapColumn(w) > 0)
lines++;
WrapColumnFinder finder(this);
while(finder.nextWrapColumn(w) > 0)
lines++;
- qreal h = lines * fontMetrics()->lineSpacing();
+ qreal spacing = qMax(fontMetrics()->lineSpacing(), fontMetrics()->height()); // cope with negative leading()
+ qreal h = lines * spacing;
if(!wrapList.count()) return; // empty chatitem
qreal h = 0;
if(!wrapList.count()) return; // empty chatitem
qreal h = 0;
+ qreal spacing = qMax(fontMetrics()->lineSpacing(), fontMetrics()->height()); // cope with negative leading()
WrapColumnFinder finder(this);
layout->beginLayout();
forever {
WrapColumnFinder finder(this);
layout->beginLayout();
forever {
}
line.setPosition(QPointF(0, h));
}
line.setPosition(QPointF(0, h));
- h += fontMetrics()->lineSpacing();