1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #336 from krepa098/master

fixes #332, #334 and other visual glitches
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-09-28 19:21:21 +02:00
commit c05497b420
13 changed files with 49 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/group_2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>714</width> <width>712</width>
<height>541</height> <height>539</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -2083,8 +2083,8 @@ QSplitter:handle{
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>262</width> <width>261</width>
<height>375</height> <height>373</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"/> <layout class="QVBoxLayout" name="verticalLayout_5"/>
@ -2587,7 +2587,7 @@ QSplitter:handle{
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="res.qrc"> <iconset resource="res.qrc">
<normaloff>:/img/group.png</normaloff>:/img/group.png</iconset> <normaloff>:/img/group_2x.png</normaloff>:/img/group_2x.png</iconset>
</property> </property>
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
@ -3218,7 +3218,7 @@ QSplitter:handle{
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>714</width> <width>712</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>

View File

@ -143,5 +143,6 @@
<file>translations/fi.qm</file> <file>translations/fi.qm</file>
<file>translations/mannol.qm</file> <file>translations/mannol.qm</file>
<file>img/avatar_mask.png</file> <file>img/avatar_mask.png</file>
<file>img/group_2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -3,18 +3,16 @@ QScrollArea {
} }
QScrollBar:vertical { QScrollBar:vertical {
background: transparent; background: rgb(65,65,65);
width: 14px; width: 16px;
margin-top: 2px; padding: 0px 3px 0px 3px;
margin-bottom: 2px;
} }
QScrollBar:handle:vertical { QScrollBar:handle:vertical {
background: rgba(18, 18, 18, 204); background: rgba(18, 18, 18, 204);
min-height: 20px; min-height: 20px;
border-radius: 3px; border-radius: 5px;
margin-left: 3px; margin: 3px 0px 3px 0px;
margin-right: 1px;
} }
QScrollBar:handle:vertical:hover { QScrollBar:handle:vertical:hover {

View File

@ -21,14 +21,19 @@
#include <QScrollBar> #include <QScrollBar>
#include <QDebug> #include <QDebug>
AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) : AdjustingScrollArea::AdjustingScrollArea(QWidget *parent)
QScrollArea(parent) : QScrollArea(parent)
{ {
} }
void AdjustingScrollArea::resizeEvent(QResizeEvent *ev) void AdjustingScrollArea::resizeEvent(QResizeEvent *ev)
{ {
int scrollBarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->sizeHint().width() : 0;
if (layoutDirection() == Qt::RightToLeft)
setViewportMargins(-scrollBarWidth, 0, 0, 0);
updateGeometry(); updateGeometry();
QScrollArea::resizeEvent(ev); QScrollArea::resizeEvent(ev);
} }
@ -43,3 +48,16 @@ QSize AdjustingScrollArea::sizeHint() const
return QScrollArea::sizeHint(); 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);
}

View File

@ -25,12 +25,9 @@ class AdjustingScrollArea : public QScrollArea
public: public:
explicit AdjustingScrollArea(QWidget *parent = 0); explicit AdjustingScrollArea(QWidget *parent = 0);
virtual void resizeEvent(QResizeEvent *ev); virtual void resizeEvent(QResizeEvent *ev) override;
virtual QSize sizeHint() const override; virtual QSize sizeHint() const override;
signals: virtual bool eventFilter(QObject *obj, QEvent *ev) override;
public slots:
}; };
#endif // ADJUSTINGSCROLLAREA_H #endif // ADJUSTINGSCROLLAREA_H

View File

@ -19,6 +19,7 @@
#include "group.h" #include "group.h"
#include "settings.h" #include "settings.h"
#include "widget/form/groupchatform.h" #include "widget/form/groupchatform.h"
#include "widget/maskablepixmapwidget.h"
#include <QPalette> #include <QPalette>
#include <QMenu> #include <QMenu>
#include <QContextMenuEvent> #include <QContextMenuEvent>
@ -38,7 +39,8 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
textLayout.setMargin(0); textLayout.setMargin(0);
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft 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")); statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
name.setText(Name); name.setText(Name);
QFont small; QFont small;
@ -65,7 +67,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
textLayout.addStretch(); textLayout.addStretch();
layout.addSpacing(20); layout.addSpacing(20);
layout.addWidget(&avatar); layout.addWidget(avatar);
layout.addSpacing(5); layout.addSpacing(5);
layout.addLayout(&textLayout); layout.addLayout(&textLayout);
layout.addStretch(); layout.addStretch();
@ -118,7 +120,7 @@ void GroupWidget::setAsActiveChatroom()
QPalette pal3; QPalette pal3;
pal3.setColor(QPalette::Background, Qt::white); pal3.setColor(QPalette::Background, Qt::white);
this->setPalette(pal3); this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/group_dark.png")); avatar->setPixmap(QPixmap(":img/group_dark.png"));
} }
void GroupWidget::setAsInactiveChatroom() void GroupWidget::setAsInactiveChatroom()
@ -137,7 +139,7 @@ void GroupWidget::setAsInactiveChatroom()
QPalette pal3; QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255)); pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3); this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/group.png")); avatar->setPixmap(QPixmap(":img/group.png"));
} }
void GroupWidget::updateStatusLight() void GroupWidget::updateStatusLight()

View File

@ -20,6 +20,8 @@
#include <QLabel> #include <QLabel>
#include "genericchatroomwidget.h" #include "genericchatroomwidget.h"
class MaskablePixmapWidget;
class GroupWidget : public GenericChatroomWidget class GroupWidget : public GenericChatroomWidget
{ {
Q_OBJECT Q_OBJECT
@ -39,7 +41,8 @@ signals:
public: public:
int groupId; int groupId;
QLabel avatar, name, nusers, statusPic; QLabel name, nusers, statusPic;
MaskablePixmapWidget* avatar;
}; };
#endif // GROUPWIDGET_H #endif // GROUPWIDGET_H

View File

@ -23,6 +23,10 @@ MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString
, clickable(false) , clickable(false)
{ {
setFixedSize(size); setFixedSize(size);
QPixmap pmapMask = QPixmap(maskName);
if (!pmapMask.isNull())
mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
} }