diff options
author | Aidan Hahn <aidan@aidanis.online> | 2019-08-28 21:36:28 -0700 |
---|---|---|
committer | Aidan Hahn <aidan@aidanis.online> | 2019-08-28 21:36:28 -0700 |
commit | b10d453bd5341587e94702f98b86f307ed2a4c92 (patch) | |
tree | c5c863a62bc9fd9ffe61124e064ac65572c22d4b /src/RoomInfoListItem.cpp | |
parent | rounding options for Avatar class (diff) | |
download | nheko-b10d453bd5341587e94702f98b86f307ed2a4c92.tar.xz |
add controll bits for avatar rounding
Diffstat (limited to 'src/RoomInfoListItem.cpp')
-rw-r--r-- | src/RoomInfoListItem.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index 9bcce134..0ff4a00f 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -287,7 +287,11 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) p.setPen(Qt::NoPen); p.setBrush(brush); - p.drawEllipse(avatarRegion.center(), wm.iconSize / 2, wm.iconSize / 2); + rounded_ ? + p.drawEllipse(avatarRegion.center(), wm.iconSize / 2, wm.iconSize / 2) : + p.drawRoundedRect( avatarRegion, + AVATAR_RECT_ROUND, + AVATAR_RECT_ROUND); QFont bubbleFont; bubbleFont.setPointSizeF(bubbleFont.pointSizeF() * 1.4); @@ -300,7 +304,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) p.save(); QPainterPath path; - path.addEllipse(wm.padding, wm.padding, wm.iconSize, wm.iconSize); + rounded_ ? + path.addEllipse(wm.padding, wm.padding, wm.iconSize, wm.iconSize) : + path.addRoundedRect( avatarRegion, + AVATAR_RECT_ROUND, + AVATAR_RECT_ROUND); + p.setClipPath(path); p.drawPixmap(avatarRegion, roomAvatar_); @@ -446,3 +455,9 @@ RoomInfoListItem::setDescriptionMessage(const DescInfo &info) lastMsgInfo_ = info; update(); } + +void +RoomInfoListItem::setRounded(bool setting) +{ + rounded_ = setting; +} |