From f2ff4772a78c89ebc72c6e66ea72664261424127 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Fri, 19 May 2017 16:49:25 +0300 Subject: [PATCH] Reverse colors on selection for the unread message bubble --- src/RoomInfoListItem.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc index 672a926..a7c9005 100644 --- a/src/RoomInfoListItem.cc +++ b/src/RoomInfoListItem.cc @@ -94,9 +94,15 @@ void RoomInfoListItem::paintEvent(QPaintEvent *event) p.setPen(Qt::NoPen); if (unreadMsgCount_ > 0) { + QColor textColor("white"); + QColor backgroundColor("#38A3D8"); + QBrush brush; brush.setStyle(Qt::SolidPattern); - brush.setColor(QColor("#38A3D8")); + brush.setColor(backgroundColor); + + if (isPressed_) + brush.setColor(textColor); p.setBrush(brush); p.setPen(Qt::NoPen); @@ -113,7 +119,11 @@ void RoomInfoListItem::paintEvent(QPaintEvent *event) p.setPen(Qt::NoPen); p.drawEllipse(r); - p.setPen(QPen(QColor("white"))); + p.setPen(QPen(textColor)); + + if (isPressed_) + p.setPen(QPen(backgroundColor)); + p.setBrush(Qt::NoBrush); p.drawText(r.translated(0, -0.5), Qt::AlignCenter, QString::number(unreadMsgCount_)); }