-//!\brief Draw ChatLine on the given QPainter at the given position.
-void ChatLine::draw(QPainter *p, const QPointF &pos) {
- QPalette pal = QApplication::palette();
-
- if(selectionMode == Full) {
- p->setPen(Qt::NoPen);
- p->setBrush(pal.brush(QPalette::Highlight));
- p->drawRect(QRectF(pos, QSizeF(tsWidth + QtUi::style()->sepTsSender() + senderWidth + QtUi::style()->sepSenderText() + textWidth, height())));
- } else if(selectionMode == Partial) {
-
- } /*
- p->setClipRect(QRectF(pos, QSizeF(tsWidth, height())));
- tsLayout.draw(p, pos, tsFormat);
- p->setClipRect(QRectF(pos + QPointF(tsWidth + Style::sepTsSender(), 0), QSizeF(senderWidth, height())));
- senderLayout.draw(p, pos + QPointF(tsWidth + Style::sepTsSender(), 0), senderFormat);
- p->setClipping(false);
- textLayout.draw(p, pos + QPointF(tsWidth + Style::sepTsSender() + senderWidth + Style::sepSenderText(), 0), textFormat);
- */
- //p->setClipRect(QRectF(pos, QSizeF(tsWidth, 15)));
- //p->drawRect(QRectF(pos, QSizeF(tsWidth, minHeight)));
- p->setBackgroundMode(Qt::OpaqueMode);
- QPointF tp = pos;
- QRectF rect(pos, QSizeF(tsWidth, minHeight));
- QRectF brect;
- foreach(FormatRange fr, tsFormat) {
- p->setFont(fr.format.font());
- p->setPen(QPen(fr.format.foreground(), 0)); p->setBackground(fr.format.background());
- p->drawText(rect, Qt::AlignLeft|Qt::TextSingleLine, styledTimeStamp.text.mid(fr.start, fr.length), &brect);
- rect.setLeft(brect.right());
- }
- rect = QRectF(pos + QPointF(tsWidth + QtUi::style()->sepTsSender(), 0), QSizeF(senderWidth, minHeight));
- for(int i = senderFormat.count() - 1; i >= 0; i--) {
- FormatRange fr = senderFormat[i];
- p->setFont(fr.format.font()); p->setPen(QPen(fr.format.foreground(), 0)); p->setBackground(fr.format.background());
- p->drawText(rect, Qt::AlignRight|Qt::TextSingleLine, styledSender.text.mid(fr.start, fr.length), &brect);
- rect.setRight(brect.left());