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

fix(ui): provide context when emitting friendWidgetRenamed()

Qt5 documentation at http://doc.qt.io/qt-5/signalsandslots.html
explains:

"[...] we provide /this/ as context in the call to connect(). The
context object provides information about in which thread the receiver
should be executed. This is important, as providing the context ensures
that the receiver is executed in the context thread."

Fixes #5495.
This commit is contained in:
Teemu Ikonen 2019-01-15 19:57:12 +02:00
parent 55ef1e0370
commit 0b6d6d7715

View File

@ -71,7 +71,7 @@ FriendWidget::FriendWidget(std::shared_ptr<FriendChatroom> chatroom, bool compac
connect(nameLabel, &CroppingLabel::editFinished, frnd, &Friend::setAlias); connect(nameLabel, &CroppingLabel::editFinished, frnd, &Friend::setAlias);
// update on changes of the displayed name // update on changes of the displayed name
connect(frnd, &Friend::displayedNameChanged, nameLabel, &CroppingLabel::setText); connect(frnd, &Friend::displayedNameChanged, nameLabel, &CroppingLabel::setText);
connect(frnd, &Friend::displayedNameChanged, [this](const QString /* &newName */){emit friendWidgetRenamed(this);}); connect(frnd, &Friend::displayedNameChanged, this, [this](const QString /* &newName */){emit friendWidgetRenamed(this);});
connect(chatroom.get(), &FriendChatroom::activeChanged, this, &FriendWidget::setActive); connect(chatroom.get(), &FriendChatroom::activeChanged, this, &FriendWidget::setActive);
statusMessageLabel->setTextFormat(Qt::PlainText); statusMessageLabel->setTextFormat(Qt::PlainText);
} }