|
|
|
|
@ -51,7 +51,8 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int textH = measureTextHeight(option.font, text, textW); |
|
|
|
|
int bubbleH = kPadTop + (hasQuote ? qH + kQuoteGap : 0) + textH + kStatusH + kPadBot; |
|
|
|
|
int authorH = QFontMetrics(option.font).height(); |
|
|
|
|
int bubbleH = kPadTop + authorH + 2 + (hasQuote ? qH + kQuoteGap : 0) + textH + kStatusH + kPadBot; |
|
|
|
|
L.totalHeight = qMax(bubbleH, kAvatar) + kItemGap; |
|
|
|
|
|
|
|
|
|
int contentLeft = kMarginH + kAvatar + kGap; |
|
|
|
|
@ -60,6 +61,9 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
|
|
|
|
|
int contentTop = kPadTop; |
|
|
|
|
|
|
|
|
|
L.authorRect = QRect(contentLeft + kPadH, contentTop, textW, authorH); |
|
|
|
|
contentTop += authorH + 2; |
|
|
|
|
|
|
|
|
|
if (hasQuote) { |
|
|
|
|
L.quoteRect = QRect(contentLeft + kPadH, contentTop, bubbleW - 2 * kPadH, qH); |
|
|
|
|
L.quoteBarRect = QRect(L.quoteRect.left(), L.quoteRect.top(), |
|
|
|
|
@ -103,6 +107,13 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
|
|
|
|
|
|
|
|
|
drawAvatar(painter, L, index); |
|
|
|
|
|
|
|
|
|
QFont authorFont = option.font; |
|
|
|
|
authorFont.setBold(true); |
|
|
|
|
painter->setFont(authorFont); |
|
|
|
|
painter->setPen(QColor(0x33, 0x90, 0xEC)); |
|
|
|
|
painter->drawText(L.authorRect, Qt::AlignLeft | Qt::AlignVCenter, |
|
|
|
|
index.data(MsgAuthorRole).toString()); |
|
|
|
|
|
|
|
|
|
painter->setPen(option.palette.text().color()); |
|
|
|
|
QFont textFont = option.font; |
|
|
|
|
textFont.setPointSize(textFont.pointSize()); |
|
|
|
|
|