mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix avatar layering in room list
This commit is contained in:
parent
1a2b8b7a6b
commit
328a3c7ebd
5 changed files with 15 additions and 15 deletions
|
@ -126,7 +126,7 @@ RoomInfoListItem,
|
||||||
UserMentionsWidget {
|
UserMentionsWidget {
|
||||||
qproperty-mentionedColor: #a82353;
|
qproperty-mentionedColor: #a82353;
|
||||||
qproperty-highlightedBackgroundColor: #4d84c7;
|
qproperty-highlightedBackgroundColor: #4d84c7;
|
||||||
qproperty-hoverBackgroundColor: rgba(230, 230, 230, 30);
|
qproperty-hoverBackgroundColor: rgb(67, 70, 77);
|
||||||
qproperty-backgroundColor: #2d3139;
|
qproperty-backgroundColor: #2d3139;
|
||||||
|
|
||||||
qproperty-titleColor: #e4e5e8;
|
qproperty-titleColor: #e4e5e8;
|
||||||
|
@ -156,7 +156,7 @@ RoomInfoListItem > Avatar {
|
||||||
|
|
||||||
CommunitiesListItem {
|
CommunitiesListItem {
|
||||||
qproperty-highlightedBackgroundColor: #4d84c7;
|
qproperty-highlightedBackgroundColor: #4d84c7;
|
||||||
qproperty-hoverBackgroundColor: rgba(230, 230, 230, 30);
|
qproperty-hoverBackgroundColor: rgb(67, 70, 77);
|
||||||
qproperty-backgroundColor: #2d3139;
|
qproperty-backgroundColor: #2d3139;
|
||||||
|
|
||||||
qproperty-avatarBgColor: #202228;
|
qproperty-avatarBgColor: #202228;
|
||||||
|
@ -200,7 +200,7 @@ TopSection {
|
||||||
}
|
}
|
||||||
|
|
||||||
emoji--Category {
|
emoji--Category {
|
||||||
qproperty-hoverBackgroundColor: rgba(230, 230, 230, 30);
|
qproperty-hoverBackgroundColor: rgb(67, 70, 77);
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingButton {
|
FloatingButton {
|
||||||
|
|
|
@ -93,7 +93,7 @@ RaisedButton {
|
||||||
RoomInfoListItem {
|
RoomInfoListItem {
|
||||||
qproperty-mentionedColor: #a82353;
|
qproperty-mentionedColor: #a82353;
|
||||||
qproperty-highlightedBackgroundColor: #38A3D8;
|
qproperty-highlightedBackgroundColor: #38A3D8;
|
||||||
qproperty-hoverBackgroundColor: rgba(200, 200, 200, 40);
|
qproperty-hoverBackgroundColor: rgb(70, 77, 93);
|
||||||
qproperty-hoverTitleColor: #f2f5f8;
|
qproperty-hoverTitleColor: #f2f5f8;
|
||||||
qproperty-hoverSubtitleColor: white;
|
qproperty-hoverSubtitleColor: white;
|
||||||
qproperty-backgroundColor: #f2f5f8;
|
qproperty-backgroundColor: #f2f5f8;
|
||||||
|
@ -122,7 +122,7 @@ RoomInfoListItem > Avatar {
|
||||||
|
|
||||||
CommunitiesListItem {
|
CommunitiesListItem {
|
||||||
qproperty-highlightedBackgroundColor: #38A3D8;
|
qproperty-highlightedBackgroundColor: #38A3D8;
|
||||||
qproperty-hoverBackgroundColor: rgba(200, 200, 200, 40);
|
qproperty-hoverBackgroundColor: rgb(70, 77, 93);
|
||||||
qproperty-backgroundColor: #f2f5f8;
|
qproperty-backgroundColor: #f2f5f8;
|
||||||
|
|
||||||
qproperty-avatarBgColor: #eee;
|
qproperty-avatarBgColor: #eee;
|
||||||
|
@ -199,7 +199,7 @@ emoji--Panel QScrollBar:vertical { width: 0px; margin: 0px; }
|
||||||
emoji--Panel QScrollBar::handle:vertical { min-height: 30px; }
|
emoji--Panel QScrollBar::handle:vertical { min-height: 30px; }
|
||||||
|
|
||||||
emoji--Category {
|
emoji--Category {
|
||||||
qproperty-hoverBackgroundColor: rgba(200, 200, 200, 70);
|
qproperty-hoverBackgroundColor: rgb(70, 77, 93);
|
||||||
}
|
}
|
||||||
|
|
||||||
emoji--Category,
|
emoji--Category,
|
||||||
|
|
|
@ -84,9 +84,9 @@ RoomInfoListItem::init(QWidget *parent)
|
||||||
ripple_overlay_->setClipPath(path);
|
ripple_overlay_->setClipPath(path);
|
||||||
ripple_overlay_->setClipping(true);
|
ripple_overlay_->setClipping(true);
|
||||||
|
|
||||||
avatar_ = new Avatar(this, wm.iconSize);
|
avatar_ = new Avatar(nullptr, wm.iconSize);
|
||||||
avatar_->setLetter(utils::firstChar(roomName_));
|
avatar_->setLetter(utils::firstChar(roomName_));
|
||||||
avatar_->move(wm.padding, wm.padding);
|
avatar_->resize(wm.iconSize, wm.iconSize);
|
||||||
|
|
||||||
unreadCountFont_.setPointSizeF(unreadCountFont_.pointSizeF() * 0.8);
|
unreadCountFont_.setPointSizeF(unreadCountFont_.pointSizeF() * 0.8);
|
||||||
unreadCountFont_.setBold(true);
|
unreadCountFont_.setBold(true);
|
||||||
|
@ -146,20 +146,27 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
auto wm = getMetrics(QFont{});
|
auto wm = getMetrics(QFont{});
|
||||||
|
|
||||||
|
QPixmap pixmap(avatar_->size());
|
||||||
if (isPressed_) {
|
if (isPressed_) {
|
||||||
p.fillRect(rect(), highlightedBackgroundColor_);
|
p.fillRect(rect(), highlightedBackgroundColor_);
|
||||||
titlePen.setColor(highlightedTitleColor_);
|
titlePen.setColor(highlightedTitleColor_);
|
||||||
subtitlePen.setColor(highlightedSubtitleColor_);
|
subtitlePen.setColor(highlightedSubtitleColor_);
|
||||||
|
pixmap.fill(highlightedBackgroundColor_);
|
||||||
} else if (underMouse()) {
|
} else if (underMouse()) {
|
||||||
p.fillRect(rect(), hoverBackgroundColor_);
|
p.fillRect(rect(), hoverBackgroundColor_);
|
||||||
titlePen.setColor(hoverTitleColor_);
|
titlePen.setColor(hoverTitleColor_);
|
||||||
subtitlePen.setColor(hoverSubtitleColor_);
|
subtitlePen.setColor(hoverSubtitleColor_);
|
||||||
|
pixmap.fill(hoverBackgroundColor_);
|
||||||
} else {
|
} else {
|
||||||
p.fillRect(rect(), backgroundColor_);
|
p.fillRect(rect(), backgroundColor_);
|
||||||
titlePen.setColor(titleColor_);
|
titlePen.setColor(titleColor_);
|
||||||
subtitlePen.setColor(subtitleColor_);
|
subtitlePen.setColor(subtitleColor_);
|
||||||
|
pixmap.fill(backgroundColor_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avatar_->render(&pixmap, QPoint(), QRegion(), RenderFlags(DrawChildren));
|
||||||
|
p.drawPixmap(QPoint(wm.padding, wm.padding), pixmap);
|
||||||
|
|
||||||
// Description line with the default font.
|
// Description line with the default font.
|
||||||
int bottom_y = wm.maxHeight - wm.padding - metrics.ascent() / 2;
|
int bottom_y = wm.maxHeight - wm.padding - metrics.ascent() / 2;
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,6 @@ Avatar::backgroundColor() const
|
||||||
return background_color_;
|
return background_color_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
Avatar::size() const
|
|
||||||
{
|
|
||||||
return size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
Avatar::sizeHint() const
|
Avatar::sizeHint() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@ public:
|
||||||
|
|
||||||
QColor backgroundColor() const;
|
QColor backgroundColor() const;
|
||||||
QColor textColor() const;
|
QColor textColor() const;
|
||||||
int size() const;
|
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue