Refactored Avatar and RoomInfoListItem to access rounding settings in place
This commit is contained in:
parent
b10d453bd5
commit
a1c2aed36a
8 changed files with 22 additions and 2267119 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QtGlobal>
|
||||
#include <QSettings>
|
||||
|
||||
#include "Cache.h"
|
||||
#include "Config.h"
|
||||
|
|
@ -140,6 +141,8 @@ RoomInfoListItem::resizeEvent(QResizeEvent *)
|
|||
void
|
||||
RoomInfoListItem::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
bool rounded = QSettings().value("user/avatar/circles", true).toBool();
|
||||
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter p(this);
|
||||
|
|
@ -287,11 +290,9 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(brush);
|
||||
|
||||
rounded_ ?
|
||||
rounded ?
|
||||
p.drawEllipse(avatarRegion.center(), wm.iconSize / 2, wm.iconSize / 2) :
|
||||
p.drawRoundedRect( avatarRegion,
|
||||
AVATAR_RECT_ROUND,
|
||||
AVATAR_RECT_ROUND);
|
||||
p.drawRoundedRect(avatarRegion, 3, 3);
|
||||
|
||||
QFont bubbleFont;
|
||||
bubbleFont.setPointSizeF(bubbleFont.pointSizeF() * 1.4);
|
||||
|
|
@ -304,11 +305,9 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
p.save();
|
||||
|
||||
QPainterPath path;
|
||||
rounded_ ?
|
||||
rounded ?
|
||||
path.addEllipse(wm.padding, wm.padding, wm.iconSize, wm.iconSize) :
|
||||
path.addRoundedRect( avatarRegion,
|
||||
AVATAR_RECT_ROUND,
|
||||
AVATAR_RECT_ROUND);
|
||||
path.addRoundedRect(avatarRegion, 3, 3);
|
||||
|
||||
p.setClipPath(path);
|
||||
|
||||
|
|
@ -455,9 +454,3 @@ RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
|
|||
lastMsgInfo_ = info;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
RoomInfoListItem::setRounded(bool setting)
|
||||
{
|
||||
rounded_ = setting;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue