diff --git a/img/contact.png b/img/contact.png index e98b4d7ec..3b4950144 100644 Binary files a/img/contact.png and b/img/contact.png differ diff --git a/img/contact_dark.png b/img/contact_dark.png index 584a4669e..a1c77479a 100644 Binary files a/img/contact_dark.png and b/img/contact_dark.png differ diff --git a/img/group.png b/img/group.png index eadc7487b..3afec19c0 100644 Binary files a/img/group.png and b/img/group.png differ diff --git a/img/group_2x.png b/img/group_2x.png new file mode 100644 index 000000000..eadc7487b Binary files /dev/null and b/img/group_2x.png differ diff --git a/img/group_dark.png b/img/group_dark.png index 55147f6c9..b5875a234 100644 Binary files a/img/group_dark.png and b/img/group_dark.png differ diff --git a/mainwindow.ui b/mainwindow.ui index a197594bd..385ecb489 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 714 - 541 + 712 + 539 @@ -2083,8 +2083,8 @@ QSplitter:handle{ 0 0 - 262 - 375 + 261 + 373 @@ -2587,7 +2587,7 @@ QSplitter:handle{ - :/img/group.png:/img/group.png + :/img/group_2x.png:/img/group_2x.png true @@ -3218,7 +3218,7 @@ QSplitter:handle{ 0 0 - 714 + 712 25 diff --git a/res.qrc b/res.qrc index 603fc8ba2..d085ca820 100644 --- a/res.qrc +++ b/res.qrc @@ -143,5 +143,6 @@ translations/fi.qm translations/mannol.qm img/avatar_mask.png + img/group_2x.png diff --git a/ui/friendList/friendList.css b/ui/friendList/friendList.css index 55b39e1e6..8358f5a04 100644 --- a/ui/friendList/friendList.css +++ b/ui/friendList/friendList.css @@ -3,18 +3,16 @@ QScrollArea { } QScrollBar:vertical { - background: transparent; - width: 14px; - margin-top: 2px; - margin-bottom: 2px; + background: rgb(65,65,65); + width: 16px; + padding: 0px 3px 0px 3px; } QScrollBar:handle:vertical { background: rgba(18, 18, 18, 204); min-height: 20px; - border-radius: 3px; - margin-left: 3px; - margin-right: 1px; + border-radius: 5px; + margin: 3px 0px 3px 0px; } QScrollBar:handle:vertical:hover { diff --git a/widget/adjustingscrollarea.cpp b/widget/adjustingscrollarea.cpp index bb273fa90..2bd9cd3e8 100644 --- a/widget/adjustingscrollarea.cpp +++ b/widget/adjustingscrollarea.cpp @@ -21,14 +21,19 @@ #include #include -AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) : - QScrollArea(parent) +AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) + : QScrollArea(parent) { } void AdjustingScrollArea::resizeEvent(QResizeEvent *ev) { + int scrollBarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->sizeHint().width() : 0; + + if (layoutDirection() == Qt::RightToLeft) + setViewportMargins(-scrollBarWidth, 0, 0, 0); + updateGeometry(); QScrollArea::resizeEvent(ev); } @@ -43,3 +48,16 @@ QSize AdjustingScrollArea::sizeHint() const return QScrollArea::sizeHint(); } + +bool AdjustingScrollArea::eventFilter(QObject *obj, QEvent *ev) +{ + if (ev->type() == QEvent::Paint) + { + // workaround: sometimes a child widget gets drawn on top of the scrollbar + // so we trigger a repaint afterwards + verticalScrollBar()->update(); + horizontalScrollBar()->update(); + } + + return QObject::eventFilter(obj, ev); +} diff --git a/widget/adjustingscrollarea.h b/widget/adjustingscrollarea.h index a1645cbba..380ac5df8 100644 --- a/widget/adjustingscrollarea.h +++ b/widget/adjustingscrollarea.h @@ -25,12 +25,9 @@ class AdjustingScrollArea : public QScrollArea public: explicit AdjustingScrollArea(QWidget *parent = 0); - virtual void resizeEvent(QResizeEvent *ev); + virtual void resizeEvent(QResizeEvent *ev) override; virtual QSize sizeHint() const override; -signals: - -public slots: - + virtual bool eventFilter(QObject *obj, QEvent *ev) override; }; #endif // ADJUSTINGSCROLLAREA_H diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index b8c1cbcc0..7bd1683c9 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -19,6 +19,7 @@ #include "group.h" #include "settings.h" #include "widget/form/groupchatform.h" +#include "widget/maskablepixmapwidget.h" #include #include #include @@ -38,7 +39,8 @@ GroupWidget::GroupWidget(int GroupId, QString Name) textLayout.setMargin(0); setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft - avatar.setPixmap(QPixmap(":img/group.png")); + avatar = new MaskablePixmapWidget(this, QSize(40,40), QString(), Qt::transparent); + avatar->setPixmap(QPixmap(":img/group.png")); statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); name.setText(Name); QFont small; @@ -65,7 +67,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name) textLayout.addStretch(); layout.addSpacing(20); - layout.addWidget(&avatar); + layout.addWidget(avatar); layout.addSpacing(5); layout.addLayout(&textLayout); layout.addStretch(); @@ -118,7 +120,7 @@ void GroupWidget::setAsActiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, Qt::white); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":img/group_dark.png")); + avatar->setPixmap(QPixmap(":img/group_dark.png")); } void GroupWidget::setAsInactiveChatroom() @@ -137,7 +139,7 @@ void GroupWidget::setAsInactiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, QColor(65,65,65,255)); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":img/group.png")); + avatar->setPixmap(QPixmap(":img/group.png")); } void GroupWidget::updateStatusLight() diff --git a/widget/groupwidget.h b/widget/groupwidget.h index 54d1ee533..960ab9cb7 100644 --- a/widget/groupwidget.h +++ b/widget/groupwidget.h @@ -20,6 +20,8 @@ #include #include "genericchatroomwidget.h" +class MaskablePixmapWidget; + class GroupWidget : public GenericChatroomWidget { Q_OBJECT @@ -39,7 +41,8 @@ signals: public: int groupId; - QLabel avatar, name, nusers, statusPic; + QLabel name, nusers, statusPic; + MaskablePixmapWidget* avatar; }; #endif // GROUPWIDGET_H diff --git a/widget/maskablepixmapwidget.cpp b/widget/maskablepixmapwidget.cpp index 966143a0a..90eaf9552 100644 --- a/widget/maskablepixmapwidget.cpp +++ b/widget/maskablepixmapwidget.cpp @@ -23,7 +23,11 @@ MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString , clickable(false) { setFixedSize(size); - mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + + QPixmap pmapMask = QPixmap(maskName); + + if (!pmapMask.isNull()) + mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } void MaskablePixmapWidget::setClickable(bool clickable)