mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Fix inconsistent user color updates.
This commit is contained in:
parent
2ba51c821e
commit
f869ff5ded
1 changed files with 5 additions and 4 deletions
|
@ -608,17 +608,18 @@ void
|
||||||
TimelineItem::refreshAuthorColor()
|
TimelineItem::refreshAuthorColor()
|
||||||
{
|
{
|
||||||
if (userName_) {
|
if (userName_) {
|
||||||
QString userColor = Cache::userColor(userName_->text());
|
QString userColor = Cache::userColor(userName_->toolTip());
|
||||||
if (userColor.isEmpty()) {
|
if (userColor.isEmpty()) {
|
||||||
// This attempts to refresh this item since it's not drawn
|
// This attempts to refresh this item since it's not drawn
|
||||||
// which allows us to get the background color accurately.
|
// which allows us to get the background color accurately.
|
||||||
qApp->style()->polish(this);
|
qApp->style()->polish(this);
|
||||||
// generate user's unique color.
|
// generate user's unique color.
|
||||||
auto backCol = backgroundColor().name();
|
auto backCol = backgroundColor().name();
|
||||||
userColor = utils::generateContrastingHexColor(userName_->text(), backCol);
|
userColor = utils::generateContrastingHexColor(userName_->toolTip(), backCol);
|
||||||
Cache::insertUserColor(userName_->text(), userColor);
|
Cache::insertUserColor(userName_->toolTip(), userColor);
|
||||||
userName_->setStyleSheet("QLabel { color : " + userColor + "; }");
|
|
||||||
}
|
}
|
||||||
|
userName_->setStyleSheet("QLabel { color : " + userColor + "; }");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The username/timestamp is displayed along with the message body.
|
// The username/timestamp is displayed along with the message body.
|
||||||
|
|
Loading…
Reference in a new issue