Add hover color on RoomList items

This commit is contained in:
Konstantinos Sideris 2017-05-19 03:45:46 +03:00
parent f4522f9bbf
commit 48618b438f
2 changed files with 5 additions and 1 deletions

View File

@ -64,7 +64,7 @@ private:
QPixmap roomAvatar_;
bool isPressed_;
bool isPressed_ = false;
int maxHeight_ = 60;
int unreadMsgCount_ = 0;

View File

@ -32,6 +32,8 @@ RoomInfoListItem::RoomInfoListItem(RoomState state, QString room_id, QWidget *pa
, unreadMsgCount_(0)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setMouseTracking(true);
setAttribute(Qt::WA_Hover);
setFixedHeight(maxHeight_);
setMaximumSize(parent->width(), maxHeight_);
@ -55,6 +57,8 @@ void RoomInfoListItem::paintEvent(QPaintEvent *event)
if (isPressed_)
p.fillRect(rect(), QColor("#38A3D8"));
else if (underMouse())
p.fillRect(rect(), QColor(200, 200, 200, 128));
else
p.fillRect(rect(), QColor("#F8FBFE"));