1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

get rid of .setBlockFormat(..) in ChatAreaWidget::insertMessage(..) function

This commit is contained in:
apprb 2014-09-13 01:54:03 +07:00
parent 2aff9fde5c
commit 968b46a86b
2 changed files with 8 additions and 8 deletions

View File

@ -44,10 +44,10 @@ ChatAreaWidget::ChatAreaWidget(QWidget *parent) :
chatTextTable->format().setCellSpacing(2);
chatTextTable->format().setWidth(QTextLength(QTextLength::PercentageLength,100));
nameFormat.setAlignment(Qt::AlignRight);
nameFormat.setNonBreakableLines(true);
dateFormat.setAlignment(Qt::AlignLeft);
dateFormat.setNonBreakableLines(true);
// nameFormat.setAlignment(Qt::AlignRight);
// nameFormat.setNonBreakableLines(true);
// dateFormat.setAlignment(Qt::AlignLeft);
// dateFormat.setNonBreakableLines(true);
connect(this, &ChatAreaWidget::anchorClicked, this, &ChatAreaWidget::onAnchorClicked);
connect(verticalScrollBar(), SIGNAL(rangeChanged(int,int)), this, SLOT(onSliderRangeChanged()));
@ -104,8 +104,8 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction)
checkSlider();
int row = chatTextTable->rows() - 1;
chatTextTable->cellAt(row,0).firstCursorPosition().setBlockFormat(nameFormat);
chatTextTable->cellAt(row,2).firstCursorPosition().setBlockFormat(dateFormat);
// chatTextTable->cellAt(row,0).firstCursorPosition().setBlockFormat(nameFormat);
// chatTextTable->cellAt(row,2).firstCursorPosition().setBlockFormat(dateFormat);
QTextCursor cur = chatTextTable->cellAt(row,1).firstCursorPosition();
cur.clearSelection();
cur.setKeepPositionOnInsert(true);

View File

@ -43,9 +43,9 @@ QString ChatAction::QImage2base64(const QImage &img)
QString ChatAction::getName()
{
if (isMe)
return QString("<div class=name_me>" + toHtmlChars(name) + "</div>");
return QString("<table width=100% cellspacing=0><tr><td align=right><div class=name_me>" + toHtmlChars(name) + "</div></td></tr></table>");
else
return QString("<div class=name>" + toHtmlChars(name) + "</div>");
return QString("<table width=100% cellspacing=0><tr><td align=right><div class=name>" + toHtmlChars(name) + "</div></td></tr></table>");
}
QString ChatAction::getDate()