mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Highlighted the user's own chat messages.
This commit is contained in:
parent
d764ef79ed
commit
5073439007
1 changed files with 13 additions and 8 deletions
|
@ -200,14 +200,14 @@ void ChatWindow::participantsChanged() {
|
|||
QLabel* userLabel = new QLabel();
|
||||
userLabel->setText(participantName);
|
||||
userLabel->setStyleSheet("background-color: palette(light);"
|
||||
"border-radius: 5px;"
|
||||
"color: #267077;"
|
||||
"padding-top: 3px;"
|
||||
"padding-right: 2px;"
|
||||
"padding-bottom: 2px;"
|
||||
"padding-left: 2px;"
|
||||
"border: 1px solid palette(shadow);"
|
||||
"font-weight: bold");
|
||||
"border-radius: 5px;"
|
||||
"color: #267077;"
|
||||
"padding-top: 3px;"
|
||||
"padding-right: 2px;"
|
||||
"padding-bottom: 2px;"
|
||||
"padding-left: 2px;"
|
||||
"border: 1px solid palette(shadow);"
|
||||
"font-weight: bold");
|
||||
userLabel->setProperty("user", participantName);
|
||||
userLabel->setCursor(Qt::PointingHandCursor);
|
||||
userLabel->installEventFilter(this);
|
||||
|
@ -232,6 +232,11 @@ void ChatWindow::messageReceived(const QXmppMessage& message) {
|
|||
messageLabel->setStyleSheet("padding: 2px; margin-right: 20px");
|
||||
messageLabel->setAlignment(Qt::AlignTop);
|
||||
|
||||
if (getParticipantName(message.from()) == AccountManager::getInstance().getUsername()) {
|
||||
userLabel->setStyleSheet(userLabel->styleSheet() + "; color: palette(highlight)");
|
||||
messageLabel->setStyleSheet(messageLabel->styleSheet() + "; color: palette(highlight)");
|
||||
}
|
||||
|
||||
ui->messagesGridLayout->addWidget(userLabel, ui->messagesGridLayout->rowCount(), 0, Qt::AlignTop | Qt::AlignRight);
|
||||
ui->messagesGridLayout->addWidget(messageLabel, ui->messagesGridLayout->rowCount() - 1, 1);
|
||||
ui->messagesGridLayout->parentWidget()->updateGeometry();
|
||||
|
|
Loading…
Reference in a new issue